From a589cb1dcd387b5ae9ffe2308e0160b7e28427bf Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 1 Oct 2016 01:41:30 +0800 Subject: [PATCH] Access simple bindings directly instead of accessing them via the Groovy engine --- source/net/filebot/format/ExpressionFormat.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/format/ExpressionFormat.java b/source/net/filebot/format/ExpressionFormat.java index b81ef1f1..db36ce32 100644 --- a/source/net/filebot/format/ExpressionFormat.java +++ b/source/net/filebot/format/ExpressionFormat.java @@ -270,7 +270,13 @@ public class ExpressionFormat extends Format { @Override public Object eval(ScriptContext context) throws ScriptException { try { - return context.getAttribute(name); + Object value = context.getAttribute(name); + if (value == null) { + throw new MissingPropertyException(name, Variable.class); + } + return value; + } catch (Exception e) { + throw new ScriptException(e); } catch (Throwable t) { throw new ScriptException(new ExecutionException(t)); }