diff --git a/pkg/cloudprovider/providers/vsphere/vsphere.go b/pkg/cloudprovider/providers/vsphere/vsphere.go index a3c3d156d6a..70119e6e37e 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere.go @@ -262,6 +262,10 @@ func getVMName(client *govmomi.Client, cfg *VSphereConfig) (string, error) { return "", err } + if svm == nil { + return "", fmt.Errorf("unable to find machine reference by UUID") + } + var vm mo.VirtualMachine err = s.Properties(ctx, svm.Reference(), []string{"name"}, &vm) if err != nil {