scripting: deep copy custom variables to avoid unwanted mutations

This commit is contained in:
jean-emmanuel 2022-03-20 22:17:36 +01:00
parent 86abea7a3a
commit 9bd3b9d186
2 changed files with 2 additions and 2 deletions

View file

@ -746,7 +746,7 @@ class Widget extends EventEmitter {
}
}
var r = this.variables[name].value
var r = deepCopy(this.variables[name].value)
var varname = 'VAR_' + varnumber
varnumber--

View file

@ -187,7 +187,7 @@ class ScriptVm extends Vm {
for (var i = widgets.length - 1; i >= 0; i--) {
if (widgets[i].variables[name]) return widgets[i].variables[name].value
if (widgets[i].variables[name]) return deepCopy(widgets[i].variables[name].value)
}