From 3c9e1fbc0c47cfbd5afb23826d036e394e7f8ece Mon Sep 17 00:00:00 2001 From: Philipp Walter Date: Thu, 30 May 2024 14:39:10 +0200 Subject: [PATCH] fix(transfer): prevent NaN percentage --- src/screens/Lightning/QuickConfirm.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/screens/Lightning/QuickConfirm.tsx b/src/screens/Lightning/QuickConfirm.tsx index 42e0e8801..b9f67894b 100644 --- a/src/screens/Lightning/QuickConfirm.tsx +++ b/src/screens/Lightning/QuickConfirm.tsx @@ -52,10 +52,10 @@ const QuickConfirm = ({ const lspFee = purchaseFeeValue.fiatValue - clientBalance.fiatValue; const savingsAmount = onchainBalance - spendingAmount; - const spendingPercentage = Math.round( - (spendingAmount / onchainBalance) * 100, - ); - const savingsPercentage = Math.round((savingsAmount / onchainBalance) * 100); + const spendingPercentage = + Math.round((spendingAmount / onchainBalance) * 100) || 0; + const savingsPercentage = + Math.round((savingsAmount / onchainBalance) * 100) || 0; const handleConfirm = async (): Promise => { setLoading(true);