Skip to content

Commit

Permalink
add nil check to LogResourceAction
Browse files Browse the repository at this point in the history
Signed-off-by: John Pitman <[email protected]>
  • Loading branch information
jopit committed Dec 11, 2024
1 parent 145a450 commit bbe3cbc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/argoutil/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bbe3cbc

Please sign in to comment.