Check for nil filter (#714)

This commit is contained in:
Bill Rich 2022-08-15 14:24:19 -07:00 committed by GitHub
parent 67004fe68a
commit af34a6a108
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,6 +86,9 @@ func FilterRulesFromFile(source string) (*FilterRuleSet, error) {
// Pass returns true if the include FilterRuleSet matches the pattern and the exclude FilterRuleSet does not match.
func (filter *Filter) Pass(object string) bool {
if filter == nil {
return true
}
excluded := filter.exclude.Matches(object)
included := filter.include.Matches(object)
return !excluded && included