diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index 8afd9267a..0d286f6e9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -3251,8 +3251,6 @@ public class Graph { if (stopPartKind.get(i) == StopPartKind.BLOCK_CLOSE) { if (stopPart.get(i) == part) { isRealStopPart = true; - } else if (stopPart.get(i).start >= code.size()) { //end of as1/2 function - continue; } break; } @@ -3672,9 +3670,16 @@ public class Graph { List stopPart2 = new ArrayList<>(stopPart); List stopPartKind2 = new ArrayList<>(stopPartKind); - if ((!isEmpty) && (next != null)) { + if (!isEmpty && next != null) { + //handle end of as1/2 script or function + if (next.start >= code.size()) { + next = null; + } + } + + if ((!isEmpty) && (next != null)) { stopPart2.add(next); - stopPartKind2.add(StopPartKind.BLOCK_CLOSE); + stopPartKind2.add(StopPartKind.BLOCK_CLOSE); } List onTrue = new ArrayList<>(); diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java index e56c52ffd..533afeced 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java @@ -432,13 +432,10 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase { + "if(_loc1_ == 3)\n" + "{\n" + "trace(\"C\");\n" - + "}\n" - + "else\n" - + "{\n" - + "trace(\"B\");\n" - + "}\n" + "return;\n" + "}\n" + + "trace(\"B\");\n" + + "}\n" + "}\n" + "else\n" + "{\n"