From 730ab47ca8880938e016b3ace290d2b832751be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 30 Nov 2022 22:27:37 +0100 Subject: [PATCH] Fixed #1888 AS3 - Nullpointer in try..catch detection in cmodule --- .../flash/abc/avm2/graph/AVM2Graph.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 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 6472ee3bb..86966534f 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 @@ -339,25 +339,27 @@ public class AVM2Graph extends Graph { int finEndIp = avm2code.adr2pos(ex.end, true) - 1; GraphPart prevFinallyEndPart = searchPart(finEndIp, allParts); - for (int j = prevFinallyEndPart.start; j <= prevFinallyEndPart.end; j++) { - AVM2Instruction ins = avm2code.code.get(j); - if (ins.definition instanceof NopIns) { + if (prevFinallyEndPart != null) { + for (int j = prevFinallyEndPart.start; j <= prevFinallyEndPart.end; j++) { + AVM2Instruction ins = avm2code.code.get(j); + if (ins.definition instanceof NopIns) { - } else if (ins.definition instanceof PushByteIns) { - defaultPushByte = ins.operands[0]; - localData.pushDefaultPart.put(e, prevFinallyEndPart); - } else if (ins.definition instanceof JumpIns) { - } else { - if (localData.pushDefaultPart.containsKey(e)) { - localData.pushDefaultPart.remove(e); + } else if (ins.definition instanceof PushByteIns) { + defaultPushByte = ins.operands[0]; + localData.pushDefaultPart.put(e, prevFinallyEndPart); + } else if (ins.definition instanceof JumpIns) { + } else { + if (localData.pushDefaultPart.containsKey(e)) { + localData.pushDefaultPart.remove(e); + } + defaultPushByte = null; + break; } - defaultPushByte = null; - break; } } if (defaultPushByte == null) { - if (avm2code.code.get(prevFinallyEndPart.end).definition instanceof JumpIns) { + if (prevFinallyEndPart != null && (avm2code.code.get(prevFinallyEndPart.end).definition instanceof JumpIns)) { prevFinallyEndPart = prevFinallyEndPart.nextParts.get(0); if (prevFinallyEndPart.nextParts.size() == 1 && prevFinallyEndPart.nextParts.get(0).refs.size() > 1) { for (int j = prevFinallyEndPart.start; j <= prevFinallyEndPart.end; j++) {