Skip to content

Commit 9b642bd

Browse files
committed
fix(cache): handle empty namespaces in buildDefaultNamespaces function
Signed-off-by: Mahagon <874007+Mahagon@users.noreply.github.com>
1 parent 01bb211 commit 9b642bd

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎cmd/main.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,14 @@ func buildDefaultNamespaces(watchNamespace string) map[string]cache.Config {
200200
}
201201
result := map[string]cache.Config{}
202202
for _, ns := range strings.Split(watchNamespace, ",") {
203-
result[strings.TrimSpace(ns)] = cache.Config{}
203+
ns = strings.TrimSpace(ns)
204+
if ns == "" {
205+
continue
206+
}
207+
result[ns] = cache.Config{}
208+
}
209+
if len(result) == 0 {
210+
return nil
204211
}
205212
return result
206213
}

0 commit comments

Comments
 (0)