From b6e2ec9d30c7002bf41fc8edfd0465c957b8304b Mon Sep 17 00:00:00 2001 From: Heba Elayoty Date: Tue, 24 Jan 2023 09:00:32 -0800 Subject: [PATCH] Add AddressPrefix nil pointer check Signed-off-by: Heba Elayoty --- pkg/network/aci_network.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/network/aci_network.go b/pkg/network/aci_network.go index 0903b594..0f56f4be 100644 --- a/pkg/network/aci_network.go +++ b/pkg/network/aci_network.go @@ -149,8 +149,9 @@ func (pn *ProviderNetwork) setupNetwork(ctx context.Context, azConfig *auth.Conf if errdefs.IsNotFound(err) && pn.SubnetCIDR == "" { return fmt.Errorf("subnet '%s' is not found in vnet '%s' in resource group '%s' and subscription '%s' and subnet CIDR is not specified", pn.SubnetName, pn.VnetName, pn.VnetResourceGroup, pn.VnetSubscriptionID) } - if err == nil { - currentSubnet := response.Subnet + currentSubnet := response.Subnet + + if err == nil && currentSubnet.Properties.AddressPrefix != nil { if pn.SubnetCIDR == "" { pn.SubnetCIDR = *currentSubnet.Properties.AddressPrefix }