Do not throw exceptions when using model.* bindings
@see https://www.filebot.net/forums/viewtopic.php?f=8&t=5083
This commit is contained in:
parent
c881f6be3c
commit
ba024fcdc9
|
@ -29,7 +29,7 @@ public class AssociativeScriptObject extends GroovyObjectSupport implements Iter
|
|||
return value;
|
||||
}
|
||||
|
||||
return super.getProperty(name);
|
||||
return super.getProperty(name); // throw MissingPropertyException
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1230,7 +1230,18 @@ public class MediaBindingBean {
|
|||
return null; // never throw exceptions for empty or null values
|
||||
}
|
||||
};
|
||||
return new AssociativeScriptObject(new ExpressionBindings(mediaBindingBean));
|
||||
|
||||
return new AssociativeScriptObject(new ExpressionBindings(mediaBindingBean)) {
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) {
|
||||
try {
|
||||
return super.getProperty(name);
|
||||
} catch (Exception e) {
|
||||
return null; // never throw exceptions for empty or null values
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private AssociativeScriptObject createPropertyBindings(Object object) {
|
||||
|
@ -1239,12 +1250,11 @@ public class MediaBindingBean {
|
|||
@Override
|
||||
public Object getProperty(String name) {
|
||||
Object value = super.getProperty(name);
|
||||
|
||||
if (value == null) {
|
||||
return undefined(name);
|
||||
}
|
||||
if (value instanceof CharSequence) {
|
||||
return replacePathSeparators(value.toString()).trim(); // auto-clean value of path separators
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue