From 16a48a6004ff34fb2a6a266011925f06621d4136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 7 Jun 2015 14:55:26 +0200 Subject: [PATCH] Fix opening nonexistent files on restoring last session --- src/com/jpexs/decompiler/flash/gui/Main.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index b8029c337..436254e21 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1143,15 +1143,21 @@ public class Main { String lastSession = Configuration.lastSessionFiles.get(); if (lastSession != null && lastSession.length() > 0) { String[] filesToOpen = lastSession.split(File.pathSeparator, -1); - SWFSourceInfo[] sourceInfos = new SWFSourceInfo[filesToOpen.length]; + List exfiles = new ArrayList<>(); for (int i = 0; i < filesToOpen.length; i++) { - String fileToOpen = filesToOpen[i]; - sourceInfos[i] = new SWFSourceInfo(null, fileToOpen, null); + if (new File(filesToOpen[i]).exists()) { + exfiles.add(filesToOpen[i]); + } + } + SWFSourceInfo[] sourceInfos = new SWFSourceInfo[exfiles.size()]; + for (int i = 0; i < exfiles.size(); i++) { + sourceInfos[i] = new SWFSourceInfo(null, exfiles.get(i), null); + } + if (sourceInfos.length > 0) { + openFile(sourceInfos, () -> { + mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get()); + }); } - - openFile(sourceInfos, () -> { - mainFrame.getPanel().tagTree.setSelectionPathString(Configuration.lastSessionSelection.get()); - }); } } }