From 19abaa26d5d26419706469392a511831d084917b Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Fri, 22 Sep 2023 12:32:53 -0500 Subject: [PATCH] fix error check in networktype shim --- equinix/helpers_device.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 }