From 16dd0f6ebf312f24e5d8a3243fd36ba787eed807 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Wed, 2 Jul 2025 19:10:02 +0300 Subject: [PATCH] set the first voucher as the active voucher when the current active sym is not found in the vouchers response --- handlers/application/menuhandler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index 426fcef..e8f899b 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -2088,8 +2088,9 @@ func (h *MenuHandlers) ManageVouchers(ctx context.Context, sym string, input []b } if activeData == nil { - logg.ErrorCtxf(ctx, "activeSym not found in vouchers", "activeSym", activeSymStr) - return res, fmt.Errorf("activeSym %s not found in vouchers", activeSymStr) + logg.ErrorCtxf(ctx, "activeSym not found in vouchers, setting the first voucher as the default", "activeSym", activeSymStr) + firstVoucher := vouchersResp[0] + activeData = &firstVoucher } // Scale down the balance