diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFSourceInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFSourceInfo.java index 6e3ba055d..5af85af0c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFSourceInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFSourceInfo.java @@ -37,7 +37,18 @@ public class SWFSourceInfo { private final String fileTitle; private final boolean detectBundle; + + private boolean empty = false; + public SWFSourceInfo(String fileTitle) { + this(null, null, fileTitle, false); + empty = true; + } + + public boolean isEmpty() { + return empty; + } + public SWFSourceInfo(InputStream inputStream, String file, String fileTitle) { this(inputStream, file, fileTitle, true); } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 7e0e2aae3..53c88105f 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1359,7 +1359,12 @@ public class Main { Helper.freeMem(); showModeFrame(); return true; - } else { + } else { + for (int i = sourceInfos.size() - 1; i >= 0; i--) { + if (sourceInfos.get(i).isEmpty()) { + sourceInfos.remove(i); + } + } SWFSourceInfo[] sourceInfosCopy = new SWFSourceInfo[sourceInfos.size()]; sourceInfos.toArray(sourceInfosCopy); sourceInfos.clear(); @@ -1478,7 +1483,7 @@ public class Main { } String ext = newFileDialog.isGfx() ? "gfx" : "swf"; String fileTitle = AppStrings.translate("new.filename") + "." + ext; - SWFSourceInfo sourceInfo = new SWFSourceInfo(new ByteArrayInputStream(new byte[0]), null, fileTitle); + SWFSourceInfo sourceInfo = new SWFSourceInfo(fileTitle); sourceInfos.add(sourceInfo); SWFList list = new SWFList(); list.sourceInfo = sourceInfo; diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 4879c3164..63a5ff809 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -731,6 +731,7 @@ public abstract class MainFrameMenu implements MenuBuilder { boolean hasDebugger = hasAbc && DebuggerTools.hasDebugger(swf); MainPanel mainPanel = mainFrame.getPanel(); boolean swfLoaded = mainPanel != null ? !mainPanel.getSwfs().isEmpty() : false; + boolean swfIsNew = swfSelected && swf.swfList != null && swf.swfList.sourceInfo.isEmpty(); setMenuEnabled("_/open", !isWorking); setMenuEnabled("/file/open", !isWorking); @@ -743,7 +744,7 @@ public abstract class MainFrameMenu implements MenuBuilder { setMenuEnabled("/file/close", swfSelected && !isWorking); setMenuEnabled("_/closeAll", swfLoaded && !isWorking); setMenuEnabled("/file/closeAll", swfLoaded && !isWorking); - setMenuEnabled("/file/reload", swfSelected && !isWorking); + setMenuEnabled("/file/reload", swfSelected && !swfIsNew && !isWorking); setMenuEnabled("/file/export", swfSelected); setMenuEnabled("_/exportAll", swfSelected && !isWorking);