From 15e11f816b077bc3eadbfaf65a6022a7391ca3d0 Mon Sep 17 00:00:00 2001 From: Philipp Walter Date: Fri, 31 May 2024 11:23:16 +0200 Subject: [PATCH] fix(transfer): prevent NaN percentage (#1918) --- 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);