diff --git a/CHANGELOG.md b/CHANGELOG.md index 30bfa53d7..370814dba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ All notable changes to this project will be documented in this file. - AS1/2 - get/set top level properties - AS1/2 - properties postincrement - AS1/2 - direct editation - allow call on numbers, boolean, etc. +- AS1/2 - direct editation - try..finally without catch clause ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java index c5623ac54..dc476326f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java @@ -185,7 +185,7 @@ public class TryActionItem extends ActionItem implements Block { int catchSize = 0; int catchRegister = 0; boolean catchInRegisterFlag = false; - if (catchCommands != null && !catchCommands.isEmpty()) { + if (!catchCommands.isEmpty()) { List fullCatchBody = new ArrayList<>(); @@ -266,7 +266,7 @@ public class TryActionItem extends ActionItem implements Block { finallySize = Action.actionsToBytes(finallyCommandsA, false, SWF.DEFAULT_VERSION).length; } int trySize = Action.actionsToBytes(tryCommandsA, false, SWF.DEFAULT_VERSION).length; - ret.add(new ActionTry(catchInRegisterFlag, finallyCommands != null, catchCommands != null, catchName, catchRegister, trySize, catchSize, finallySize, SWF.DEFAULT_VERSION)); + ret.add(new ActionTry(catchInRegisterFlag, finallyCommands != null, !catchCommands.isEmpty(), catchName, catchRegister, trySize, catchSize, finallySize, SWF.DEFAULT_VERSION)); ret.addAll(tryCommandsA); if (catchCommandsA != null) { ret.addAll(catchCommandsA); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index 985438d72..88fe7a5d8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -1313,7 +1313,7 @@ public class ActionScript2Parser { tryCommands.add(command(inFunction, inMethod, forinlevel, inTellTarget, true, variables, functions, hasEval)); s = lex(); boolean found = false; - List> catchCommands = null; + List> catchCommands = new ArrayList<>(); List catchExceptionNames = new ArrayList<>(); List catchExceptionTypes = new ArrayList<>(); @@ -1330,9 +1330,6 @@ public class ActionScript2Parser { lexer.pushback(s); } expectedType(SymbolType.PARENT_CLOSE); - if (catchCommands == null) { - catchCommands = new ArrayList<>(); - } List cc = new ArrayList<>(); cc.add(command(inFunction, inMethod, forinlevel, inTellTarget, true, variables, functions, hasEval)); catchCommands.add(cc);