mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-17 15:56:39 +00:00
Add nil check in CheckRoutes to prevent potential panic
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user