diff --git a/equinix/helpers_device.go b/equinix/helpers_device.go index 3cec2a4fa..7109b088a 100644 --- a/equinix/helpers_device.go +++ b/equinix/helpers_device.go @@ -130,13 +130,13 @@ func getNetworkInfo(ips []*packngo.IPAddressAssignment) NetworkInfo { } func getNetworkTypeMetalGo(device *metalv1.Device) (*string, error) { - pgDevice := packngo.Device{} res, err := device.MarshalJSON() - if err != nil { - json.Unmarshal(res, pgDevice) - networkType := pgDevice.GetNetworkType() - return &networkType, nil + if err == nil { + if err = json.Unmarshal(res, &pgDevice); err == nil { + networkType := pgDevice.GetNetworkType() + return &networkType, nil + } } return nil, err }