From 05f2a0be85cc9294a49d107ddda71c5cb21d66ee Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 12 Nov 2016 04:46:14 +0800 Subject: [PATCH] Catch potential IOExceptions --- source/net/filebot/cli/GroovyPad.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/net/filebot/cli/GroovyPad.java b/source/net/filebot/cli/GroovyPad.java index 00e1ab62..4d07c413 100644 --- a/source/net/filebot/cli/GroovyPad.java +++ b/source/net/filebot/cli/GroovyPad.java @@ -144,13 +144,19 @@ public class GroovyPad extends JFrame { return new RTextScrollPane(output, true); } - protected FileLocation getFileLocation(String name) throws IOException { - File pad = ApplicationFolder.AppData.resolve(name); - if (!pad.exists()) { + protected FileLocation getFileLocation(String name) { + try { // use this default value so people can easily submit bug reports with fn:sysinfo logs - ScriptShellMethods.saveAs(DEFAULT_SCRIPT, pad); + File pad = ApplicationFolder.AppData.resolve(name); + + if (!pad.exists()) { + ScriptShellMethods.saveAs(DEFAULT_SCRIPT, pad); + return FileLocation.create(pad); + } + } catch (Exception e) { + debug.log(Level.WARNING, e, e::toString); } - return FileLocation.create(pad); + return null; } protected final ScriptShell shell;