prevent unhashable panic

This commit is contained in:
2023-03-14 00:07:18 +00:00
parent cf25d392be
commit 406eafb8a4
7 changed files with 53 additions and 23 deletions

View File

@@ -244,6 +244,10 @@ func setVariableValue(v setVariable, stack stack, stacklevel int) (any, ArErr) {
}
switch y := respp.(type) {
case ArMap:
keytype := typeof(key)
if keytype == "array" || keytype == "map" {
return nil, ArErr{TYPE: "TypeError", message: "Cannot use unhashable value as key: " + keytype, EXISTS: true}
}
varMutex.Lock()
y[key] = resp
varMutex.Unlock()