Added some additional validation checks on wallet status.

This commit is contained in:
Brendon Duncan 2018-07-19 13:03:29 +12:00
commit d2d1511e61

View file

@ -671,7 +671,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
}; };
function updateAvailableFundsFromWallet(wallet) { function updateAvailableFundsFromWallet(wallet) {
if (wallet.status) { if (wallet.status && wallet.status.isValid) {
availableFundsInCrypto = wallet.status.spendableBalanceStr; availableFundsInCrypto = wallet.status.spendableBalanceStr;
availableSatoshis = wallet.status.spendableAmount; availableSatoshis = wallet.status.spendableAmount;
if (wallet.status.alternativeBalanceAvailable) { if (wallet.status.alternativeBalanceAvailable) {
@ -680,7 +680,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
availableFundsInFiat = ''; availableFundsInFiat = '';
} }
} else if (wallet.cachedStatus) { } else if (wallet.cachedStatus && wallet.status.isValid) {
if (wallet.cachedStatus.alternativeBalanceAvailable) { if (wallet.cachedStatus.alternativeBalanceAvailable) {
availableFundsInFiat = wallet.cachedStatus.spendableBalanceAlternative + ' ' + wallet.cachedStatus.alternativeIsoCode; availableFundsInFiat = wallet.cachedStatus.spendableBalanceAlternative + ' ' + wallet.cachedStatus.alternativeIsoCode;