From 40d55c870e9fe63e6fc33f69e829258bc03eebd0 Mon Sep 17 00:00:00 2001 From: Alexander Hebel Date: Tue, 29 Oct 2024 10:19:16 +0100 Subject: [PATCH] Fix nil check after findRouteTable --- pkg/controller/infrastructure/infraflow/reconcile.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/controller/infrastructure/infraflow/reconcile.go b/pkg/controller/infrastructure/infraflow/reconcile.go index 36f2d5c0b..56908469a 100644 --- a/pkg/controller/infrastructure/infraflow/reconcile.go +++ b/pkg/controller/infrastructure/infraflow/reconcile.go @@ -1362,10 +1362,13 @@ func (c *FlowContext) deleteZoneRoutingTableAssociation(ctx context.Context, zon if err != nil { return err } - for _, assoc := range routeTable.Associations { - if reflect.DeepEqual(subnetID, assoc.SubnetId) { - assocID = &assoc.RouteTableAssociationId - break + // if not found routeTable might be nil + if routeTable != nil { + for _, assoc := range routeTable.Associations { + if reflect.DeepEqual(subnetID, assoc.SubnetId) { + assocID = &assoc.RouteTableAssociationId + break + } } } }