Add nil check in CheckRoutes to prevent potential panic

This commit is contained in:
Hakan Sariman
2025-03-08 12:54:33 +03:00
parent a3b8a21385
commit 1ffe48f0d4

View File

@@ -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()