From a4b63434233fd5893d0907580e1e75439c563dc5 Mon Sep 17 00:00:00 2001 From: Kyriakos Oikonomakos Date: Thu, 31 Oct 2019 15:56:21 +0000 Subject: [PATCH] Check if portgroup failure criteria is nil Sometimes govmomi will return a PortGroup spec where the failure criteria property of the nic teaming policy can be nil. When this happens we crash because the code doesn't check for this case. Addresses the crash in #869 --- vsphere/host_network_policy_structure.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vsphere/host_network_policy_structure.go b/vsphere/host_network_policy_structure.go index d5b2a06a2..0f82b5b5c 100644 --- a/vsphere/host_network_policy_structure.go +++ b/vsphere/host_network_policy_structure.go @@ -195,8 +195,10 @@ func flattenHostNicTeamingPolicy(d *schema.ResourceData, obj *types.HostNicTeami d.Set("notify_switches", obj.NotifySwitches) } d.Set("teaming_policy", obj.Policy) - if err := flattenHostNicFailureCriteria(d, obj.FailureCriteria); err != nil { - return err + if obj.FailureCriteria != nil { + if err := flattenHostNicFailureCriteria(d, obj.FailureCriteria); err != nil { + return err + } } if err := flattenHostNicOrderPolicy(d, obj.NicOrder); err != nil { return err