From bbe3cbc21ebd48da4b9c77894778fbefd304efe3 Mon Sep 17 00:00:00 2001 From: John Pitman Date: Wed, 11 Dec 2024 14:52:03 -0500 Subject: [PATCH] add nil check to LogResourceAction Signed-off-by: John Pitman --- controllers/argoutil/resource.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/argoutil/resource.go b/controllers/argoutil/resource.go index acc08e8b7..51749e2a1 100644 --- a/controllers/argoutil/resource.go +++ b/controllers/argoutil/resource.go @@ -142,6 +142,11 @@ func LogResourceDeletion(log logr.Logger, object metav1.Object, explanations ... } func LogResourceAction(log logr.Logger, action string, object metav1.Object, explanations ...string) { + if object == nil { + log.Error(nil, "missing object in LogResourceAction") + return + } + typeName := reflect.TypeOf(object).String() pos := strings.LastIndex(typeName, ".") if pos >= 0 {