diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 829cc37e4..218bde8c5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -849,8 +849,14 @@ public class AVM2SourceGenerator implements SourceGenerator { localData.catchesOpenedLoops.remove(localData.catchesOpenedLoops.size() - 1); localData.scopeStack.remove(localData.scopeStack.size() - 1); localData.catchesTempRegs.remove(localData.catchesTempRegs.size() - 1); - catchCmd.add(ins(AVM2Instructions.PopScope)); - catchCmd.addAll(toInsList(AssignableAVM2Item.killTemp(localData, this, Arrays.asList(tempReg)))); + if (!item.catchCommands.get(c).isEmpty() + && ((item.catchCommands.get(c).get(item.catchCommands.get(c).size() - 1) instanceof ContinueItem) + || (item.catchCommands.get(c).get(item.catchCommands.get(c).size() - 1) instanceof BreakItem))) { + AssignableAVM2Item.killRegister(localData, this, tempReg.getVal()); + } else { + catchCmd.add(ins(AVM2Instructions.PopScope)); + catchCmd.addAll(toInsList(AssignableAVM2Item.killTemp(localData, this, Arrays.asList(tempReg)))); + } catchCmds.add(catchCmd); } for (int c = item.catchCommands.size() - 1; c >= 0; c--) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index 6f85d868d..d70944ab5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -1736,9 +1736,10 @@ public class ActionScript3Parser { e.setSlotNumber(1); e.setSlotScope(Integer.MAX_VALUE); //will be changed later expectedType(SymbolType.PARENT_CLOSE); - List cc = new ArrayList<>(); List catchVars = new ArrayList<>(); - cc.add(command(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, catchVars)); + expectedType(SymbolType.CURLY_OPEN); + List cc = commands(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, catchVars); + expectedType(SymbolType.CURLY_CLOSE); catchesVars.add(catchVars); variables.addAll(catchVars);