From 55d920b8332363a315f14c11006f3c3cf509881a Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 8 Aug 2024 15:19:43 +0900 Subject: [PATCH] add nil checking --- resolver/resolver.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resolver/resolver.go b/resolver/resolver.go index a50cfd89..32153218 100644 --- a/resolver/resolver.go +++ b/resolver/resolver.go @@ -3159,6 +3159,15 @@ func (r *Resolver) resolveVariableExprCELValues(ctx *context, env *cel.Env, expr iter := expr.Map.Iterator mapBuilder := builder.WithMap() if iter != nil && iter.Name != "" && iter.Source != nil { + if iter.Source.Expr == nil || iter.Source.Expr.Type == nil { + ctx.addError( + ErrWithLocation( + `map iterator's src value type could not be determined`, + mapBuilder.WithIteratorSource().Location(), + ), + ) + return + } if !iter.Source.Expr.Type.Repeated { ctx.addError( ErrWithLocation(