Update *empty filter

This commit is contained in:
Trial97
2018-11-22 17:28:53 +02:00
committed by Dan Christian Bogos
parent 6186a38a66
commit 83a5041286
2 changed files with 5 additions and 0 deletions

View File

@@ -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() {

View File

@@ -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{},
}