Skip to content

Commit

Permalink
fix: slice check with null value (#222)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly authored Nov 22, 2023
1 parent 48238dc commit 65ed240
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/engine/assert/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ type sliceNode []Assertion

func (n sliceNode) assert(ctx context.Context, path *field.Path, value interface{}, bindings jpbinding.Bindings) (field.ErrorList, error) {
var errs field.ErrorList
if reflectutils.GetKind(value) != reflect.Slice {
if value == nil {
errs = append(errs, field.Invalid(path, value, "value is null"))
} else if reflectutils.GetKind(value) != reflect.Slice {
return nil, field.TypeInvalid(path, value, "expected a slice")
} else {
valueOf := reflect.ValueOf(value)
Expand Down

0 comments on commit 65ed240

Please sign in to comment.