Skip to content

Commit

Permalink
Fix #1752: Account with no balances crashes the GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Aug 3, 2018
1 parent 052186a commit a60491c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/components/Modal/ReserveAssetModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down Expand Up @@ -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 (
<form className="grid-block vertical full-width-content">
Expand Down

0 comments on commit a60491c

Please sign in to comment.