Skip to content

Commit 640be09

Browse files
Merge pull request #2183 from benluddy/pending-unpack-status-segfault
Fix nil pointer dereference while reporting bundle unpack status.
2 parents be44032 + 2a3f11a commit 640be09

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/controller/bundle/bundle_unpacker.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,15 @@ func (c *ConfigMapUnpacker) pendingContainerStatusMessages(job *batchv1.Job) (st
525525
continue
526526
}
527527

528+
msg := fmt.Sprintf("Unpack pod(%s/%s) container(%s) is pending", pod.Namespace, pod.Name, ic.Name)
529+
waiting := ic.State.Waiting
530+
if waiting != nil {
531+
msg = fmt.Sprintf("Unpack pod(%s/%s) container(%s) is pending. Reason: %s, Message: %s",
532+
pod.Namespace, pod.Name, ic.Name, waiting.Reason, waiting.Message)
533+
}
534+
528535
// Aggregate the wait reasons for all pending containers
529-
containerStatusMessages = append(containerStatusMessages,
530-
fmt.Sprintf("Unpack pod(%s/%s) container(%s) is pending. Reason: %s, Message: %s",
531-
pod.Namespace, pod.Name, ic.Name, ic.State.Waiting.Reason, ic.State.Waiting.Message))
536+
containerStatusMessages = append(containerStatusMessages, msg)
532537
}
533538
}
534539

0 commit comments

Comments
 (0)