null check added

This commit is contained in:
Roman Shevchenko 2014-06-26 14:09:36 +02:00
parent 95476dc36b
commit b13dee2567
2 changed files with 12 additions and 32 deletions

View File

@ -212,7 +212,7 @@ public class ExitHelper {
&& edge.explicit && (edge.labeled || isOnlyEdge(edge))) {
List<Exprent> data = dest.getExprents();
if(data.size() == 1) {
if(data != null && data.size() == 1) {
if(data.get(0).type == Exprent.EXPRENT_EXIT) {
return dest;
}
@ -252,8 +252,8 @@ public class ExitHelper {
for(StatEdge edge: root.getDummyExit().getAllPredecessorEdges()) {
if(!edge.explicit) {
Statement source = edge.getSource();
if(source.getExprents() != null && !source.getExprents().isEmpty()) {
List<Exprent> lstExpr = source.getExprents();
List<Exprent> lstExpr = source.getExprents();
if(lstExpr != null && !lstExpr.isEmpty()) {
Exprent expr = lstExpr.get(lstExpr.size() - 1);
if(expr.type == Exprent.EXPRENT_EXIT) {
ExitExprent ex = (ExitExprent)expr;
@ -289,8 +289,8 @@ public class ExitHelper {
}
Statement source = edge.getSource();
if(source.getExprents() != null && !source.getExprents().isEmpty()) {
List<Exprent> lstExpr = source.getExprents();
List<Exprent> lstExpr = source.getExprents();
if(lstExpr != null && !lstExpr.isEmpty()) {
Exprent expr = lstExpr.get(lstExpr.size() - 1);
if(expr.type == Exprent.EXPRENT_EXIT) {
ExitExprent ex = (ExitExprent)expr;

View File

@ -14,42 +14,19 @@
package de.fernflower.modules.decompiler;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import de.fernflower.code.CodeConstants;
import de.fernflower.code.Instruction;
import de.fernflower.code.InstructionSequence;
import de.fernflower.code.cfg.BasicBlock;
import de.fernflower.main.DecompilerContext;
import de.fernflower.main.extern.IFernflowerPreferences;
import de.fernflower.modules.decompiler.exps.ArrayExprent;
import de.fernflower.modules.decompiler.exps.AssignmentExprent;
import de.fernflower.modules.decompiler.exps.ConstExprent;
import de.fernflower.modules.decompiler.exps.ExitExprent;
import de.fernflower.modules.decompiler.exps.Exprent;
import de.fernflower.modules.decompiler.exps.FieldExprent;
import de.fernflower.modules.decompiler.exps.FunctionExprent;
import de.fernflower.modules.decompiler.exps.IfExprent;
import de.fernflower.modules.decompiler.exps.InvocationExprent;
import de.fernflower.modules.decompiler.exps.MonitorExprent;
import de.fernflower.modules.decompiler.exps.NewExprent;
import de.fernflower.modules.decompiler.exps.SwitchExprent;
import de.fernflower.modules.decompiler.exps.VarExprent;
import de.fernflower.modules.decompiler.exps.*;
import de.fernflower.modules.decompiler.sforms.DirectGraph;
import de.fernflower.modules.decompiler.sforms.DirectNode;
import de.fernflower.modules.decompiler.sforms.FlattenStatementsHelper;
import de.fernflower.modules.decompiler.sforms.FlattenStatementsHelper.FinallyPathWrapper;
import de.fernflower.modules.decompiler.stats.BasicBlockStatement;
import de.fernflower.modules.decompiler.stats.CatchAllStatement;
import de.fernflower.modules.decompiler.stats.CatchStatement;
import de.fernflower.modules.decompiler.stats.RootStatement;
import de.fernflower.modules.decompiler.stats.Statement;
import de.fernflower.modules.decompiler.stats.*;
import de.fernflower.modules.decompiler.vars.VarProcessor;
import de.fernflower.struct.StructClass;
import de.fernflower.struct.consts.ConstantPool;
@ -756,8 +733,11 @@ public class ExprProcessor implements CodeConstants {
}
public static String listToJava(List<Exprent> lst, int indent) {
String indstr = InterpreterUtil.getIndentString(indent);
if (lst == null || lst.isEmpty()) {
return "";
}
String indstr = InterpreterUtil.getIndentString(indent);
String new_line_separator = DecompilerContext.getNewLineSeparator();
StringBuffer buf = new StringBuffer();