From fd9b4a6b8b6708da0b15463246cc25177fcf9cec Mon Sep 17 00:00:00 2001 From: Sophia Date: Thu, 22 Aug 2024 10:30:00 -0400 Subject: [PATCH] Check for errors in latest price (#2401) --- centrifuge-app/src/utils/getLatestPrice.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/centrifuge-app/src/utils/getLatestPrice.ts b/centrifuge-app/src/utils/getLatestPrice.ts index 1fd40b230a..f71d0b1ab4 100644 --- a/centrifuge-app/src/utils/getLatestPrice.ts +++ b/centrifuge-app/src/utils/getLatestPrice.ts @@ -5,7 +5,8 @@ export const getLatestPrice = ( borrowerAssetTransactions: AssetTransaction[] | undefined, decimals: number ): { value: CurrencyBalance; timestamp: number } => { - if (!borrowerAssetTransactions) return { value: new CurrencyBalance(0, decimals), timestamp: 0 } + if (!borrowerAssetTransactions || !borrowerAssetTransactions.length) + return { value: new CurrencyBalance(0, decimals), timestamp: 0 } const latestTx = borrowerAssetTransactions[borrowerAssetTransactions.length - 1]