User action script: Fix script error if a context returns nil.

If a context is defined but returns nil, the script now returns nil instead.
qteditor
Sven Eberhardt 2016-08-08 15:34:06 -04:00
parent 4581022411
commit be60b276d0
1 changed files with 9 additions and 1 deletions

View File

@ -873,7 +873,15 @@ private func EvalVariable(proplist props, proplist context, expected_type)
private func EvalScript(proplist props, proplist context)
{
var script_context = EvaluateValue("Object", props.Context, context) ?? Global;
var script_context;
if (props.Context)
{
if (!(script_context = EvaluateValue("Object", props.Context, context))) return;
}
else
{
script_context = Global;
}
var script = EvaluateValue("String", props.Script, context) ?? "";
return script_context->eval(script, true);
}