diff --git a/engine/filters.go b/engine/filters.go index bfa1ad71e..38d026efc 100644 --- a/engine/filters.go +++ b/engine/filters.go @@ -288,6 +288,9 @@ func (fltr *FilterRule) passEmpty(dP config.DataProvider) (bool, error) { } return false, err } + if val == nil { + return true, nil + } rval := reflect.ValueOf(val) if rval.Type().Kind() == reflect.Ptr { if rval.IsNil() { diff --git a/engine/filters_test.go b/engine/filters_test.go index 7394bf856..7c622cd62 100644 --- a/engine/filters_test.go +++ b/engine/filters_test.go @@ -627,6 +627,7 @@ func TestInlineFilterPassFiltersForEvent(t *testing.T) { "EmptySlice": []string{""}, "EmptyMap": map[string]string{"": ""}, "EmptyPtr": &struct{}{}, + "EmptyPtr2": &struct{}{}, "EmptyPtrSlice": &[]string{""}, "EmptyPtrMap": &map[string]string{"": ""}, } @@ -637,6 +638,7 @@ func TestInlineFilterPassFiltersForEvent(t *testing.T) { "EmptySlice": []string{}, "EmptyMap": map[string]string{}, "EmptyPtr": testnil, + "EmptyPtr2": nil, "EmptyPtrSlice": &[]string{}, "EmptyPtrMap": &map[string]string{}, }