Skip to content

Commit c83ca74

Browse files
Merge pull request #4862 from openshift-cherrypick-robot/cherry-pick-4740-to-release-4.17
[release-4.17] OCPBUGS-51003: daemon: add nil check for annotation fetching
2 parents 0f85e35 + f13a830 commit c83ca74

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/daemon/node.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ func getNodeAnnotation(node *corev1.Node, k string) (string, error) {
6464

6565
// getNodeAnnotationExt is like getNodeAnnotation, but allows one to customize ENOENT handling
6666
func getNodeAnnotationExt(node *corev1.Node, k string, allowNoent bool) (string, error) {
67+
if node == nil || node.Annotations == nil {
68+
return "", fmt.Errorf("node object is nil")
69+
}
6770
v, ok := node.Annotations[k]
6871
if !ok {
6972
if !allowNoent {

0 commit comments

Comments
 (0)