From 2ec9fb2afba391c7a21e700e0449a46b24401922 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 9 Dec 2016 12:27:46 +0100 Subject: [PATCH 1/2] Be lenient around invalid owners map --- js/src/views/Accounts/accounts.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/js/src/views/Accounts/accounts.js b/js/src/views/Accounts/accounts.js index a8a29945f6a..517d35760b2 100644 --- a/js/src/views/Accounts/accounts.js +++ b/js/src/views/Accounts/accounts.js @@ -293,13 +293,17 @@ function mapStateToProps (state) { const walletsOwners = Object .keys(walletsInfo) - .map((wallet) => ({ - owners: walletsInfo[wallet].owners.map((owner) => ({ - address: owner, - name: accountsInfo[owner] && accountsInfo[owner].name || owner - })), - address: wallet - })) + .map((wallet) => { + const owners = walletsInfo[wallet].owners || []; + + return { + owners: owners.map((owner) => ({ + address: owner, + name: accountsInfo[owner] && accountsInfo[owner].name || owner + })), + address: wallet + }; + }) .reduce((walletsOwners, wallet) => { walletsOwners[wallet.address] = wallet.owners; return walletsOwners; From 4bdd8ed175e2764f7aca22ca51da5837ed5b3207 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 9 Dec 2016 12:41:56 +0100 Subject: [PATCH 2/2] Filter invalid owners before render --- js/src/views/Accounts/Summary/summary.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/src/views/Accounts/Summary/summary.js b/js/src/views/Accounts/Summary/summary.js index 764f24edfe0..aeff8a2e557 100644 --- a/js/src/views/Accounts/Summary/summary.js +++ b/js/src/views/Accounts/Summary/summary.js @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +import BigNumber from 'bignumber.js'; import React, { Component, PropTypes } from 'react'; import { Link } from 'react-router'; import { isEqual } from 'lodash'; @@ -113,15 +114,16 @@ export default class Summary extends Component { renderOwners () { const { owners } = this.props; + const ownersValid = (owners || []).filter((owner) => owner.address && new BigNumber(owner.address).gt(0)); - if (!owners || owners.length === 0) { + if (!ownersValid || ownersValid.length === 0) { return null; } return (
{ - owners.map((owner) => ( + ownersValid.map((owner) => (