From f73f32e41cba9969a1fc6fd7642897ce9fa64e59 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Sun, 16 Jul 2023 10:14:29 +0800 Subject: [PATCH] fix: parse nested `sub-rules` failed --- config/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/config.go b/config/config.go index ae2ebbde..c7ae0fe1 100644 --- a/config/config.go +++ b/config/config.go @@ -712,6 +712,9 @@ func parseRuleProviders(cfg *RawConfig) (ruleProviders map[string]providerTypes. func parseSubRules(cfg *RawConfig, proxies map[string]C.Proxy) (subRules map[string][]C.Rule, err error) { subRules = map[string][]C.Rule{} + for name := range cfg.SubRules { + subRules[name] = make([]C.Rule, 0) + } for name, rawRules := range cfg.SubRules { if len(name) == 0 { return nil, fmt.Errorf("sub-rule name is empty")