From fe28e9dbfb3e17366c3c14be5cb010467691b80c Mon Sep 17 00:00:00 2001 From: meriadec Date: Thu, 22 Mar 2018 09:00:00 +0100 Subject: [PATCH] Temporary fix balance calculation when no counter value for date --- src/helpers/balance.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/helpers/balance.js b/src/helpers/balance.js index 663a6c2f..347594ca 100644 --- a/src/helpers/balance.js +++ b/src/helpers/balance.js @@ -89,6 +89,11 @@ export function getBalanceHistoryForAccount({ balance = b / 10 ** unit.magnitude * counterVals[date] } + if (isNaN(balance)) { + console.warn(`This should not happen. Cant calculate balance for ${date}`) // eslint-disable-line no-console + return { date, balance: 0 } + } + return { date, balance } }) }