From a60491c8eb60fc6d6af570457d4dfebaaf353760 Mon Sep 17 00:00:00 2001 From: Sigve Kvalsvik Date: Fri, 3 Aug 2018 16:19:43 +0200 Subject: [PATCH] Fix #1752: Account with no balances crashes the GUI --- app/components/Modal/ReserveAssetModal.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/components/Modal/ReserveAssetModal.jsx b/app/components/Modal/ReserveAssetModal.jsx index 67843c94e5..8aa5cd63a2 100644 --- a/app/components/Modal/ReserveAssetModal.jsx +++ b/app/components/Modal/ReserveAssetModal.jsx @@ -20,7 +20,6 @@ class ReserveAssetModal extends React.Component { this.props.asset && np.asset.get("id") !== this.props.asset.get("id") ) { - console.log("new asset:", np.asset.get("id")); this.setState(this.getInitialState(np)); } } @@ -56,9 +55,13 @@ class ReserveAssetModal extends React.Component { render() { let assetId = this.props.asset.get("id"); - let currentBalance = ChainStore.getObject( - this.props.account.getIn(["balances", assetId]) - ); + let currentBalance = + this.props.account && this.props.account.get("balances", []).size + ? ChainStore.getObject( + this.props.account.getIn(["balances", assetId]) + ) + : null; + if (!currentBalance) return null; return (