@@ -100,7 +100,7 @@ func (r *Reconciler) reconcileVolumeSnapshots(ctx context.Context,
100100 r .Recorder .Event (postgrescluster , corev1 .EventTypeWarning , "VolumeSnapshotError" ,
101101 * snapshotWithLatestError .Status .Error .Message )
102102 for _ , snapshot := range snapshots .Items {
103- if snapshot .Status .Error != nil &&
103+ if snapshot .Status != nil && snapshot . Status .Error != nil &&
104104 snapshot .Status .Error .Time .Before (snapshotWithLatestError .Status .Error .Time ) {
105105 err = r .deleteControlled (ctx , postgrescluster , & snapshot )
106106 if err != nil {
@@ -536,7 +536,7 @@ func getSnapshotWithLatestError(snapshots *volumesnapshotv1.VolumeSnapshotList)
536536 },
537537 }
538538 for _ , snapshot := range snapshots .Items {
539- if snapshot .Status .Error != nil &&
539+ if snapshot .Status != nil && snapshot . Status .Error != nil &&
540540 snapshotWithLatestError .Status .Error .Time .Before (snapshot .Status .Error .Time ) {
541541 snapshotWithLatestError = snapshot
542542 }
@@ -576,7 +576,7 @@ func getLatestReadySnapshot(snapshots *volumesnapshotv1.VolumeSnapshotList) *vol
576576 },
577577 }
578578 for _ , snapshot := range snapshots .Items {
579- if snapshot .Status .ReadyToUse != nil && * snapshot .Status .ReadyToUse &&
579+ if snapshot .Status != nil && snapshot . Status .ReadyToUse != nil && * snapshot .Status .ReadyToUse &&
580580 latestReadySnapshot .Status .CreationTime .Before (snapshot .Status .CreationTime ) {
581581 latestReadySnapshot = snapshot
582582 }
0 commit comments