Don't create index if peer is empty (#435)

When checking for existing prefix routes
Return nil if peer is empty
This commit is contained in:
Maycon Santos
2022-08-23 11:09:56 +02:00
committed by GitHub
parent 09312b3e6d
commit 47add9a9c3
2 changed files with 17 additions and 10 deletions

View File

@ -79,6 +79,11 @@ func (am *DefaultAccountManager) GetRoute(accountID, routeID string) (*route.Rou
// checkPrefixPeerExists checks the combination of prefix and peer id, if it exists returns an error, otherwise returns nil
func (am *DefaultAccountManager) checkPrefixPeerExists(accountID, peer string, prefix netip.Prefix) error {
if peer == "" {
return nil
}
routesWithPrefix, err := am.Store.GetRoutesByPrefix(accountID, prefix)
if err != nil {