Skip to content

Commit

Permalink
refactor: avoid nil assingment in serial port list
Browse files Browse the repository at this point in the history
  • Loading branch information
marinsalinas committed Apr 16, 2019
1 parent 53a8d0b commit 27b1bb3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1704,17 +1704,16 @@ func preFillResUpdateRequest(res *v3.VMResources, response *v3.VMIntentResponse)
}
res.NicList = nold

spl := make([]*v3.VMSerialPort, len(response.Status.Resources.SerialPortList))
var spl []*v3.VMSerialPort
if len(response.Status.Resources.SerialPortList) > 0 {
spl = make([]*v3.VMSerialPort, len(response.Status.Resources.SerialPortList))
for k, v := range response.Status.Resources.SerialPortList {
spl[k] = &v3.VMSerialPort{
Index: v.Index,
IsConnected: v.IsConnected,
}

}
} else {
spl = nil
}
res.SerialPortList = spl

Expand Down

0 comments on commit 27b1bb3

Please sign in to comment.