fix: sub-rule condition don't work

This commit is contained in:
Skyxim 2023-01-27 12:38:15 +08:00
parent 248578086f
commit 6decaef050

View file

@ -247,7 +247,10 @@ func matchSubRules(metadata *C.Metadata, name string, subRules map[string][]C.Ru
func (logic *Logic) Match(metadata *C.Metadata) (bool, string) { func (logic *Logic) Match(metadata *C.Metadata) (bool, string) {
switch logic.ruleType { switch logic.ruleType {
case C.SubRules: case C.SubRules:
return matchSubRules(metadata, logic.adapter, logic.subRules) if m, _ := logic.rules[0].Match(metadata); m {
return matchSubRules(metadata, logic.adapter, logic.subRules)
}
return false, ""
case C.NOT: case C.NOT:
if m, _ := logic.rules[0].Match(metadata); !m { if m, _ := logic.rules[0].Match(metadata); !m {
return true, logic.adapter return true, logic.adapter