From 2572a7a1e6992be20931e449d0cd6c418b42710d Mon Sep 17 00:00:00 2001 From: Rohit Agrawal Date: Thu, 18 Nov 2021 12:10:52 -0500 Subject: [PATCH] fix: Fixed NPE while getting the ReplicaSet labels Signed-off-by: Rohit Agrawal --- utils/replicaset/replicaset.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/replicaset/replicaset.go b/utils/replicaset/replicaset.go index deb1af1da0..04134b2450 100644 --- a/utils/replicaset/replicaset.go +++ b/utils/replicaset/replicaset.go @@ -523,7 +523,7 @@ func PodTemplateEqualIgnoreHash(live, desired *corev1.PodTemplateSpec) bool { // GetPodTemplateHash returns the rollouts-pod-template-hash value from a ReplicaSet's labels func GetPodTemplateHash(rs *appsv1.ReplicaSet) string { - if rs.Labels == nil { + if rs == nil || rs.Labels == nil { return "" } return rs.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]