From f209beca7ab45c6521f1e90fed898d725ffa2079 Mon Sep 17 00:00:00 2001 From: "dmitry.lopatin" Date: Mon, 21 Oct 2024 10:17:16 +0300 Subject: [PATCH] fix inuse.go Signed-off-by: dmitry.lopatin --- .../pkg/controller/vd/internal/inuse.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/images/virtualization-artifact/pkg/controller/vd/internal/inuse.go b/images/virtualization-artifact/pkg/controller/vd/internal/inuse.go index 21cd6ae4e..36894e3d4 100644 --- a/images/virtualization-artifact/pkg/controller/vd/internal/inuse.go +++ b/images/virtualization-artifact/pkg/controller/vd/internal/inuse.go @@ -77,10 +77,12 @@ func (h InUseHandler) Handle(ctx context.Context, vd *virtv2.VirtualDisk) (recon if err != nil { return reconcile.Result{}, fmt.Errorf("error getting kubevirt virtual machine: %w", err) } - - if kvvm.Status.StateChangeRequests != nil { - inUseInRunningVirtualMachine = true + if kvvm != nil { + if kvvm.Status.StateChangeRequests != nil { + inUseInRunningVirtualMachine = true + } } + } } }