From 00136f19d09eb1cf07ce987e46bbf3a681590bd4 Mon Sep 17 00:00:00 2001 From: Taron Date: Fri, 12 Jul 2024 06:02:00 +0300 Subject: [PATCH] feat: fix nil pointer panic for type map (#9) 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`. --- evaluationStage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evaluationStage.go b/evaluationStage.go index 27add4a..965040a 100644 --- a/evaluationStage.go +++ b/evaluationStage.go @@ -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