Skip to content

Commit

Permalink
feat: fix nil pointer panic for type map (#9)
Browse files Browse the repository at this point in the history
In case of one of parameters has map type and its value is nil, script ends up with panic because of checking: `reflect.TypeOf(inter).Kind() == reflect.Func`.
  • Loading branch information
taronarm authored Jul 12, 2024
1 parent 9617456 commit 00136f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion evaluationStage.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func makeAccessorStage(pair []string) evaluationOperator {
field = coreValue.MapIndex(reflect.ValueOf(pair[i]))
if field != (reflect.Value{}) {
inter := field.Interface()
if reflect.TypeOf(inter).Kind() == reflect.Func {
if inter != nil && reflect.TypeOf(inter).Kind() == reflect.Func {
method = reflect.ValueOf(inter)
} else {
value = inter
Expand Down

0 comments on commit 00136f1

Please sign in to comment.