From 2c85203985093ed65b75e1c228b9919bee1fc5c5 Mon Sep 17 00:00:00 2001 From: MultiplyByZer0 Date: Sat, 11 Mar 2017 22:50:30 -0400 Subject: [PATCH 1/2] Prevent crash when calling insertInstruction() on empty MethodBody If an AVM2Code object is empty, and we attempt to insert an instruction, the method will execute code.get(-1) and throw an exception. This commit handles the situation. --- .../src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 19c774f43..248eaefa7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -2371,7 +2371,9 @@ public class AVM2Code implements Cloneable { pos = code.size(); } final int byteCount = instruction.getBytesLength(); - if (pos == code.size()) { + if (code.size() == 0) { + instruction.setAddress(0); + } else if (pos == code.size()) { instruction.setAddress(code.get(pos - 1).getAddress() + code.get(pos - 1).getBytesLength()); } else { instruction.setAddress(code.get(pos).getAddress()); From 53e29673eec48330ceec836e64a578cac31199f1 Mon Sep 17 00:00:00 2001 From: MultiplyByZer0 Date: Tue, 14 Mar 2017 02:53:17 -0400 Subject: [PATCH 2/2] Allow reload confirmation to be disabled If the user has disabled confirmation for closing, disable confirmation for reloading as well. --- src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 471aefe2c..8efd1cbec 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -533,7 +533,7 @@ public abstract class MainFrameMenu implements MenuBuilder { protected boolean reloadActionPerformed(ActionEvent evt) { if (swf != null) { - if (View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { + if (!Configuration.showCloseConfirmation.get() || View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { Main.reloadFile(swf.swfList); } } @@ -542,7 +542,7 @@ public abstract class MainFrameMenu implements MenuBuilder { protected boolean reloadAllActionPerformed(ActionEvent evt) { if (swf != null) { - if (View.showConfirmDialog(null, translate("message.confirm.reloadAll"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { + if (!Configuration.showCloseConfirmation.get() || View.showConfirmDialog(null, translate("message.confirm.reloadAll"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { Main.reloadApp(); }