Skip to content

Commit

Permalink
fix(transfer): prevent NaN percentage (#1918)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr authored May 31, 2024
1 parent 83007a6 commit 15e11f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/screens/Lightning/QuickConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
setLoading(true);
Expand Down

0 comments on commit 15e11f8

Please sign in to comment.