From 4adbf7e2346d6c6a506f96034c24c7dcb23cf0da Mon Sep 17 00:00:00 2001 From: Yulia Sharabi Date: Tue, 1 Oct 2024 00:22:39 +0400 Subject: [PATCH] Fix division by error error --- src/app/components/OrderBook.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/components/OrderBook.tsx b/src/app/components/OrderBook.tsx index d0dc3406..facff52b 100644 --- a/src/app/components/OrderBook.tsx +++ b/src/app/components/OrderBook.tsx @@ -249,10 +249,10 @@ function RecentTradesTab() { {lastTrades.map((trade, indx) => { - const price = Calculator.divide( - trade.token2Amount, - trade.token1Amount - ); + const price = + trade.token1Amount === 0 + ? 0 + : Calculator.divide(trade.token2Amount, trade.token1Amount); const time = trade.timestamp.split("T").join(" ").split(":00.")[0]; const amount = Math.round(trade.token1Amount); return (