From 1ffe48f0d489cd2a008987c7048eb9df37ae00d0 Mon Sep 17 00:00:00 2001 From: Hakan Sariman Date: Sat, 8 Mar 2025 12:54:33 +0300 Subject: [PATCH] Add nil check in CheckRoutes to prevent potential panic --- client/internal/peer/status.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/internal/peer/status.go b/client/internal/peer/status.go index 512034dc6..a05b8a346 100644 --- a/client/internal/peer/status.go +++ b/client/internal/peer/status.go @@ -370,6 +370,10 @@ func (d *Status) RemovePeerStateRoute(peer string, route string) error { // CheckRoutes checks if the source and destination addresses are within the same route // and returns the resource ID of the route that contains the addresses func (d *Status) CheckRoutes(src, dst netip.Addr, direction nftypes.Direction) (srcResId string, dstResId string) { + if d == nil { + return + } + d.mux.Lock() d.resIdMux.Lock() defer d.resIdMux.Unlock()