Skip to content

Commit

Permalink
fix(vmbda): fix panic (#245)
Browse files Browse the repository at this point in the history
Signed-off-by: Isteb4k <[email protected]>
  • Loading branch information
Isteb4k authored Aug 1, 2024
1 parent 7f2f963 commit 61e4ab8
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"log/slog"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
virtv1 "kubevirt.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/deckhouse/virtualization-controller/pkg/controller/service"
Expand Down Expand Up @@ -67,9 +68,12 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmbda *virtv2.VirtualMachi
return reconcile.Result{}, err
}

kvvm, err := h.attacher.GetKVVM(ctx, vm)
if err != nil {
return reconcile.Result{}, err
var kvvm *virtv1.VirtualMachine
if vm != nil {
kvvm, err = h.attacher.GetKVVM(ctx, vm)
if err != nil {
return reconcile.Result{}, err
}
}

if vmbda.DeletionTimestamp != nil {
Expand Down

0 comments on commit 61e4ab8

Please sign in to comment.