Skip to content

Commit 25b65ea

Browse files
committed
Moving nil check to correct location
1 parent ac3ef99 commit 25b65ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/common-controller/snapshot_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,11 +1279,11 @@ func (ctrl *csiSnapshotCommonController) getSnapshotFromStore(snapshotName strin
12791279
}
12801280

12811281
func (ctrl *csiSnapshotCommonController) setAnnVolumeSnapshotBeingDeleted(content *crdv1.VolumeSnapshotContent) error {
1282+
if content == nil {
1283+
return nil
1284+
}
12821285
// Set AnnVolumeSnapshotBeingDeleted if it is not set yet
12831286
if !metav1.HasAnnotation(content.ObjectMeta, utils.AnnVolumeSnapshotBeingDeleted) {
1284-
if content == nil {
1285-
return nil
1286-
}
12871287
klog.V(5).Infof("setAnnVolumeSnapshotBeingDeleted: set annotation [%s] on content [%s].", utils.AnnVolumeSnapshotBeingDeleted, content.Name)
12881288
metav1.SetMetaDataAnnotation(&content.ObjectMeta, utils.AnnVolumeSnapshotBeingDeleted, "yes")
12891289

0 commit comments

Comments
 (0)