From 82cfff3cffbcbeb4655e60707ffca8067322bcb2 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Thu, 7 Aug 2025 10:00:17 +0300 Subject: [PATCH] ips: prevent panic when no pools match filters --- ips/ips.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ips/ips.go b/ips/ips.go index e29ad539e..67d84fab2 100644 --- a/ips/ips.go +++ b/ips/ips.go @@ -338,6 +338,9 @@ func filterAndSortPools(ctx *context.Context, tenant string, pools []*utils.IPPo weights[pool.ID] = weight filteredPools = append(filteredPools, pool) } + if len(filteredPools) == 0 { + return nil, utils.ErrNotFound + } // Sort by weight (higher values first). slices.SortFunc(filteredPools, func(a, b *utils.IPPool) int {