From 497a316b041a1e7087caf37277f42533bf0921e3 Mon Sep 17 00:00:00 2001 From: Peter Schuurman Date: Tue, 8 Mar 2022 09:06:37 -0800 Subject: [PATCH] Bugfix: Check if newSnapContent.Status is set before checking if Status.Error is present --- pkg/sidecar-controller/snapshot_controller_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sidecar-controller/snapshot_controller_base.go b/pkg/sidecar-controller/snapshot_controller_base.go index eb1984bc..413ab012 100644 --- a/pkg/sidecar-controller/snapshot_controller_base.go +++ b/pkg/sidecar-controller/snapshot_controller_base.go @@ -104,7 +104,7 @@ func NewCSISnapshotSideCarController( // and CSI CreateSnapshot will be called again without exponential backoff. // So we are skipping the re-queue here to avoid CreateSnapshot being called without exponential backoff. newSnapContent := newObj.(*crdv1.VolumeSnapshotContent) - if newSnapContent.Status.Error != nil { + if newSnapContent.Status != nil && newSnapContent.Status.Error != nil { oldSnapContent := oldObj.(*crdv1.VolumeSnapshotContent) _, newExists := newSnapContent.ObjectMeta.Annotations[utils.AnnVolumeSnapshotBeingCreated] _, oldExists := oldSnapContent.ObjectMeta.Annotations[utils.AnnVolumeSnapshotBeingCreated]