From 275515917a2f2af698297017ba720387f2489c8d Mon Sep 17 00:00:00 2001 From: p4u Date: Wed, 28 Aug 2024 10:57:46 +0200 Subject: [PATCH] do not panic if token predicate not found Signed-off-by: p4u --- api/helpers.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/helpers.go b/api/helpers.go index 6ff808d0..c6c95813 100644 --- a/api/helpers.go +++ b/api/helpers.go @@ -294,6 +294,9 @@ func (capi *census3API) CalculateStrategyHolders(ctx context.Context, // it is a complex predicate, create a evaluator and evaluate the predicate if validPredicate.IsLiteral() { token := tokens[validPredicate.String()] + if token == nil { + return nil, nil, totalTokensBlockNumber, fmt.Errorf("token not found for predicate: %s", validPredicate.String()) + } // get the strategy holders from the database holders, err := capi.db.QueriesRO.TokenHoldersByMinBalance(ctx, queries.TokenHoldersByMinBalanceParams{