From c818a8fcd70f9a95a8c82aa1d0d134af52cf3769 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 16 May 2023 23:40:32 -0700 Subject: [PATCH] default balance to zero instead of panicing --- web3_proxy/src/frontend/authorization.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index 34a1b398..13403ac7 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -1116,8 +1116,8 @@ impl Web3ProxyApp { .filter(balance::Column::UserId.eq(user_model.id)) .one(db_replica.conn()) .await? - .expect("related balance") - .available_balance; + .map(|x| x.available_balance) + .unwrap_or_default(); let user_tier_model = user_tier::Entity::find_by_id(user_model.user_tier_id)