From aa1e79d067a95eb6eb9ba5774b7ae4203ef36a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Thu, 19 Sep 2024 19:44:14 +0300 Subject: [PATCH] Add nil check before filterAnnotations func in cleanupexamples tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken (cherry picked from commit 40fd9bdca210c355df6f6ec85318e58b48c8aa96) --- cmd/cleanupexamples/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/cleanupexamples/main.go b/cmd/cleanupexamples/main.go index 2f8538d..1a5dde4 100644 --- a/cmd/cleanupexamples/main.go +++ b/cmd/cleanupexamples/main.go @@ -81,6 +81,10 @@ func processYAML(yamlData []byte) ([]byte, error) { return nil, fmt.Errorf("cannot decode the YAML file: %w", err) } + if u == nil { + continue + } + // Remove specific annotations from the decoded Kubernetes object. filterAnnotations(u)