fix storage pull

This commit is contained in:
Matias Alejo Garcia 2017-02-07 16:13:28 -05:00
commit 2d3da332c4
No known key found for this signature in database
GPG key ID: 02470DB551277AB3

View file

@ -414,9 +414,9 @@ angular.module('copayApp.services')
// } // }
root.removeBitpayDebitCard = function(network, cardEid, cb) { root.removeBitpayDebitCard = function(network, cardEid, cb) {
root.getBitpayAccounts(network, function(err, allAccounts){ root.getBitpayAccounts(network, function(err, allAccounts) {
lodash.each(allAccounts, function(account){ lodash.each(allAccounts, function(account) {
account.cards = lodash.reject(account.cards, { account.cards = lodash.reject(account.cards, {
'eid': cardEid 'eid': cardEid
}); });
@ -450,7 +450,10 @@ angular.module('copayApp.services')
var allAccounts = {}; var allAccounts = {};
try { try {
allAccounts = JSON.parse(allAccountsStr); allAccounts = JSON.parse(allAccountsStr);
} catch (e) {}; } catch (e) {
$log.error('Bad storage value for bitpayAccount-v2' + allAccountsStr)
return cb(null, {});
};
var anyMigration; var anyMigration;
@ -474,10 +477,10 @@ angular.module('copayApp.services')
}); });
if (anyMigration) { if (anyMigration) {
storage.set('bitpayAccounts-v2-' + network, allAccounts, function(){ storage.set('bitpayAccounts-v2-' + network, allAccounts, function() {
return cb(err, allAccounts); return cb(err, allAccounts);
}); });
} else } else
return cb(err, allAccounts); return cb(err, allAccounts);
}); });