Skip to content

Commit

Permalink
Merge pull request #169 from yannickstruyf3/fix/#168
Browse files Browse the repository at this point in the history
Fix issue #168, unchecked nil assignment
  • Loading branch information
marinsalinas authored Nov 16, 2020
2 parents 6efb49e + 7477166 commit e6c6321
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 e6c6321

Please sign in to comment.