Merge pull request #7149 from rainzm/automated-cherry-pick-of-#7147-upstream-release-3.2

Automated cherry pick of #7147: fix: mo.VirtualMachine's Config maybe nil
This commit is contained in:
Zexi Li
2020-07-14 11:34:47 +08:00
committed by GitHub
+1 -1
View File
@@ -253,7 +253,7 @@ func (dc *SDatacenter) fetchVms(vmRefs []types.ManagedObjectReference, all bool)
for i := 0; i < len(vms); i += 1 {
if all || !strings.HasPrefix(vms[i].Entity().Name, api.ESXI_IMAGE_CACHE_TMP_PREFIX) {
vmObj := NewVirtualMachine(dc.manager, &vms[i], dc)
if vms[i].Config.Template {
if vms[i].Config != nil && vms[i].Config.Template {
templateVMs = append(templateVMs, vmObj)
continue
}