From 3de8be83f4e2f0bc1d97e84d6fe2668593924714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=BE=99=E5=B3=B0?= Date: Tue, 16 Aug 2022 09:28:57 +0800 Subject: [PATCH] check vsc null pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李龙峰 --- changelogs/unreleased/5303-lilongfeng0902 | 1 + pkg/controller/backup_controller.go | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/unreleased/5303-lilongfeng0902 diff --git a/changelogs/unreleased/5303-lilongfeng0902 b/changelogs/unreleased/5303-lilongfeng0902 new file mode 100644 index 0000000000..819069ac3e --- /dev/null +++ b/changelogs/unreleased/5303-lilongfeng0902 @@ -0,0 +1 @@ +check vsc null pointer \ No newline at end of file diff --git a/pkg/controller/backup_controller.go b/pkg/controller/backup_controller.go index eff0861ebd..f33820b1b6 100644 --- a/pkg/controller/backup_controller.go +++ b/pkg/controller/backup_controller.go @@ -940,6 +940,10 @@ func (c *backupController) deleteVolumeSnapshot(volumeSnapshots []*snapshotv1api if vs.Status.BoundVolumeSnapshotContentName != nil && len(*vs.Status.BoundVolumeSnapshotContentName) > 0 { vsc = vscMap[*vs.Status.BoundVolumeSnapshotContentName] + if nil == vsc { + logger.Errorf("Not find %s from the vscMap", vs.Status.BoundVolumeSnapshotContentName) + return + } if vsc.Spec.DeletionPolicy == snapshotv1api.VolumeSnapshotContentDelete { modifyVSCFlag = true }