add proper check (#1048)

This commit is contained in:
Thibaut Sardan 2019-04-26 17:49:19 +02:00 committed by GitHub
parent c9acb1c20e
commit c898427d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,7 +171,7 @@ class Account extends React.PureComponent<Props, State> {
private renderNominee () {
const { recentlyOffline, staking_nominators, t } = this.props;
if (!staking_nominators || !staking_nominators[0].length) {
if (!staking_nominators || !staking_nominators[0] || !staking_nominators[0].length) {
return null;
}
@ -314,8 +314,8 @@ class Account extends React.PureComponent<Props, State> {
);
}
} else {
const isNominating = staking_nominators && staking_nominators[0].length;
const isValidating = staking_validators && !(staking_validators[0].isEmpty);
const isNominating = !!staking_nominators && !!staking_nominators[0] && staking_nominators[0].length;
const isValidating = !!staking_validators && !!staking_validators[0] && !(staking_validators[0].isEmpty);
if (isValidating || isNominating) {
buttons.push(