Always set the value of implicit vars (#1922)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
pull/1836/head
Kai Kreuzer 2020-12-13 09:32:25 +01:00 committed by GitHub
parent 313fb496ce
commit 0a719cca83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -146,7 +146,12 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
for (Map.Entry<String, String> entry : IMPLICIT_VARS.entrySet()) {
Object value = context.getAttribute(entry.getKey());
if (value != null) {
evalContext.newValue(QualifiedName.create(entry.getValue()), value);
QualifiedName qn = QualifiedName.create(entry.getValue());
if (evalContext.getValue(qn) == null) {
evalContext.newValue(qn, value);
} else {
evalContext.assignValue(qn, value);
}
}
}
// now add specific implicit vars, where we have to map the right content