From c3b33b31283fd37cccca216c50e81c2a8c7706d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 31 Aug 2025 16:28:46 +0200 Subject: [PATCH] Try..catch fix --- .../flash/abc/avm2/graph/AVM2Graph.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 33bc8c745..5a0ecb587 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -1306,7 +1306,14 @@ public class AVM2Graph extends Graph { boolean isEmpty = true; for (int i = 0; i < finallyTargetItems.size(); i++) { GraphTargetItem it = finallyTargetItems.get(i); - if (it instanceof SetLocalAVM2Item) { + if (it instanceof SetTemporaryItem) { + if (it.value.getNotCoerced() instanceof ExceptionAVM2Item) { + //okay + } else { + isEmpty = false; + break; + } + } else if (it instanceof SetLocalAVM2Item) { if (it.value.getNotCoerced() instanceof ExceptionAVM2Item) { //okay } else { @@ -1431,10 +1438,14 @@ public class AVM2Graph extends Graph { List currentCatchCommands = printGraph(foundGotos, partCodes, partCodePos, visited, localData2, st2, allParts, null, catchPart, stopPart2, stopPartKind2, loops, throwStates, staticOperation, path); st2.finishBlock(currentCatchCommands); - while (!currentCatchCommands.isEmpty() - && currentCatchCommands.get(0) instanceof SetTemporaryItem - && currentCatchCommands.get(0).value.getNotCoerced() instanceof ExceptionAVM2Item) { - currentCatchCommands.remove(0); + int tempExceptionPos = 0; + if (!currentCatchCommands.isEmpty() && currentCatchCommands.get(0) instanceof WithAVM2Item) { + tempExceptionPos++; + } + while (currentCatchCommands.size() > tempExceptionPos + && currentCatchCommands.get(tempExceptionPos) instanceof SetTemporaryItem + && currentCatchCommands.get(tempExceptionPos).value.getNotCoerced() instanceof ExceptionAVM2Item) { + currentCatchCommands.remove(tempExceptionPos); } loopwith: while (!currentCatchCommands.isEmpty() && (currentCatchCommands.get(0) instanceof WithAVM2Item)) {