Skip to content

Commit

Permalink
Merge pull request nutanix#169 from yannickstruyf3/fix/nutanix#168
Browse files Browse the repository at this point in the history
Fix issue nutanix#168, unchecked nil assignment
  • Loading branch information
marinsalinas authored Nov 16, 2020
2 parents 88e4bf0 + 1659eb7 commit 87fff49
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nutanix/data_source_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,17 @@ func dataSourceNutanixVirtualMachineRead(d *schema.ResourceData, meta interface{
b := make([]string, 0)

if resp.Status.Resources.BootConfig != nil {
if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil {
i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex)))
diskAddress["device_index"] = i
diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType)
if resp.Status.Resources.BootConfig.BootDevice != nil {
if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil {
i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex)))
diskAddress["device_index"] = i
diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType)
}
mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress)
}
if resp.Status.Resources.BootConfig.BootDeviceOrderList != nil {
b = utils.StringValueSlice(resp.Status.Resources.BootConfig.BootDeviceOrderList)
}
mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress)
}

d.Set("boot_device_order_list", b)
Expand Down

0 comments on commit 87fff49

Please sign in to comment.