Skip to content

Commit eb6d3ac

Browse files
Merge pull request kubernetes-csi#16 from huffmanca/BZ1814280
Bug 1814280: UPSTREAM 278: Include a nil check for the snapshotContent
2 parents ea11bc3 + 4b22aa2 commit eb6d3ac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/common-controller/snapshot_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (ctrl *csiSnapshotCommonController) checkandRemoveSnapshotFinalizersAndChec
262262
}
263263

264264
if !inUse {
265-
klog.V(5).Infof("checkandRemoveSnapshotFinalizersAndCheckandDeleteContent: Set VolumeSnapshotBeingDeleted annotation on the content [%s]", content.Name)
265+
klog.V(5).Infof("checkandRemoveSnapshotFinalizersAndCheckandDeleteContent: Set VolumeSnapshotBeingDeleted annotation on the content")
266266
ctrl.setAnnVolumeSnapshotBeingDeleted(content)
267267

268268
klog.V(5).Infof("checkandRemoveSnapshotFinalizersAndCheckandDeleteContent: Remove Finalizer for VolumeSnapshot[%s]", utils.SnapshotKey(snapshot))
@@ -1295,6 +1295,9 @@ func (ctrl *csiSnapshotCommonController) getSnapshotFromStore(snapshotName strin
12951295
}
12961296

12971297
func (ctrl *csiSnapshotCommonController) setAnnVolumeSnapshotBeingDeleted(content *crdv1.VolumeSnapshotContent) error {
1298+
if content == nil {
1299+
return nil
1300+
}
12981301
// Set AnnVolumeSnapshotBeingDeleted if it is not set yet
12991302
if !metav1.HasAnnotation(content.ObjectMeta, utils.AnnVolumeSnapshotBeingDeleted) {
13001303
klog.V(5).Infof("setAnnVolumeSnapshotBeingDeleted: set annotation [%s] on content [%s].", utils.AnnVolumeSnapshotBeingDeleted, content.Name)

0 commit comments

Comments
 (0)