mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-01 12:31:42 +02:00
[management] handle nil ptr in sendInitialSync() when the peer is deleted (#7315)
* fix a nil-ptr error occuring in sendInitialSync when the peer being synced is deleted Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io> * handle a nil ptr in GetPeerNetworkMapComponents Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io> --------- Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
@@ -651,6 +651,11 @@ func (c *Controller) GetValidatedPeerWithComponents(ctx context.Context, isRequi
|
||||
return nil, nil, nil, nil, 0, err
|
||||
}
|
||||
|
||||
// it's possible that the peer gets deleted between the call to "sendInitialSync()" and here, bail out in this case
|
||||
if _, ok := account.Peers[peer.ID]; !ok {
|
||||
return nil, nil, nil, nil, 0, fmt.Errorf("peer '%s' no longer exists", peer.ID)
|
||||
}
|
||||
|
||||
c.injectAllProxyPolicies(ctx, account)
|
||||
|
||||
approvedPeersMap, err := c.integratedPeerValidator.GetValidatedPeers(ctx, account.Id, maps.Values(account.Groups), maps.Values(account.Peers), account.Settings.Extra)
|
||||
|
||||
Reference in New Issue
Block a user