From a838e8c43325caa7f2389e561a351e83f0d1af3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E7=8E=AE=E6=96=87?= Date: Sun, 27 Apr 2025 11:38:16 +0800 Subject: [PATCH] fix nil pointer dereference on error --- pkg/sanity/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sanity/controller.go b/pkg/sanity/controller.go index 99d68d09..00623974 100644 --- a/pkg/sanity/controller.go +++ b/pkg/sanity/controller.go @@ -494,8 +494,8 @@ var _ = DescribeSanity("Controller Service [Controller Server]", func(sc *TestCo }, } vol, err := r.CreateVolume(context.Background(), vol2Req) - Expect(vol.GetVolume().ContentSource).NotTo(BeNil()) Expect(err).NotTo(HaveOccurred()) + Expect(vol.GetVolume().ContentSource).NotTo(BeNil()) }) It("should fail when the volume source snapshot is not found", func() {