From 9fe2c81784a0d74ee4a062f64f9a47f7be779ff8 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 9 Mar 2016 06:17:25 +0000 Subject: [PATCH] Refactor --- source/net/filebot/ui/rename/FormatDialog.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index 4d0a08cc..68bdc637 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -526,7 +526,7 @@ public class FormatDialog extends JDialog { @Override protected void done() { try { - preview.setText(get()); + String value = get().trim(); // check internal script exception if (format.caughtScriptException() != null) { @@ -534,11 +534,12 @@ public class FormatDialog extends JDialog { } // check empty output - if (get().trim().isEmpty()) { + if (value.isEmpty()) { throw new Exception("Formatted value is empty"); } // no warning or error + preview.setText(value); status.setVisible(false); } catch (CancellationException e) { // ignore, cancelled tasks are obsolete anyway