From a478f675f13630410c52515da456ee22c1aa2430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Oliv=C3=A9?= Date: Thu, 24 Aug 2023 11:01:30 +0200 Subject: [PATCH] Fixed balance error when creating a new EOA account (#20585) --- ui/selectors/selectors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 1a29187ee..fecc756be 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -376,8 +376,8 @@ export const getMetaMaskAccountsConnected = createSelector( ); export function isBalanceCached(state) { - const selectedAccountBalance = - state.metamask.accounts[getSelectedAddress(state)].balance; + const selectedAccount = state.metamask.accounts[getSelectedAddress(state)]; + const selectedAccountBalance = selectedAccount && selectedAccount.balance; const cachedBalance = getSelectedAccountCachedBalance(state); return Boolean(!selectedAccountBalance && cachedBalance);