Skip to content
Snippets Groups Projects
Commit 05a104be authored by ale's avatar ale
Browse files

Make the int-map lookup return 0 by default

parent 97c50619
Branches
No related tags found
No related merge requests found
Pipeline #15063 passed
...@@ -42,10 +42,13 @@ func (m intMap) IndexGet(index tengo.Object) (tengo.Object, error) { ...@@ -42,10 +42,13 @@ func (m intMap) IndexGet(index tengo.Object) (tengo.Object, error) {
if !ok { if !ok {
return nil, tengo.ErrInvalidIndexType return nil, tengo.ErrInvalidIndexType
} }
value, ok := m[indexStr.Value]
if !ok { // value, ok := m[indexStr.Value]
return tengo.UndefinedValue, nil // if !ok {
} // return tengo.UndefinedValue, nil
// }
value := m[indexStr.Value]
return &tengo.Int{Value: value}, nil return &tengo.Int{Value: value}, nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment