From 7fe5b8a76762a08a3a61e6e891a01ea3ed0b3040 Mon Sep 17 00:00:00 2001 From: Matthias Teich Date: Thu, 27 Jun 2024 08:56:06 +0200 Subject: [PATCH] Fix NPE --- pkg/client/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index accabae..3ce8b9d 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -96,7 +96,11 @@ func (a *IONOSClient) convertServerToInstanceMetadata(ctx context.Context, serve klog.Infof("Found %v nics", len(*server.Entities.Nics.Items)) for _, nic := range *server.Entities.Nics.Items { ips := *nic.Properties.Ips - klog.Infof("Found %v ips for nic %s. Only using the first one as the remaining ones are failover ips", len(ips), *nic.Properties.Name) + nicName := "unknown" + if nic.Properties.Name != nil { + nicName = *nic.Properties.Name + } + klog.Infof("Found %v ips for nic %s. Only using the first one as the remaining ones are failover ips", len(ips), nicName) if len(ips) > 0 { ipStr := ips[0] ip := net.ParseIP(ipStr)