diff --git a/app-template/bitpay/appConfig.json b/app-template/bitpay/appConfig.json index 2bdcef286..1c9decb34 100644 --- a/app-template/bitpay/appConfig.json +++ b/app-template/bitpay/appConfig.json @@ -21,8 +21,8 @@ "windowsAppId": "2d1002d7-ee34-4f60-bd29-0c871ba0c195", "pushSenderId": "1036948132229", "description": "Secure Bitcoin Wallet", - "version": "1.3.5", - "androidVersion": "135000", + "version": "1.3.6", + "androidVersion": "136000", "_extraCSS": null, "_enabledExtensions": { "coinbase": true, diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index 5f78725a3..668e8c66a 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -414,9 +414,9 @@ angular.module('copayApp.services') // } 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, { 'eid': cardEid }); @@ -447,10 +447,16 @@ angular.module('copayApp.services') storage.get('bitpayAccounts-v2-' + network, function(err, allAccountsStr) { if (err) return cb(err); + if (!allAccountsStr) + return cb(null, {}); + var allAccounts = {}; try { allAccounts = JSON.parse(allAccountsStr); - } catch (e) {}; + } catch (e) { + $log.error('Bad storage value for bitpayAccount-v2' + allAccountsStr) + return cb(null, {}); + }; var anyMigration; @@ -474,10 +480,10 @@ angular.module('copayApp.services') }); if (anyMigration) { - storage.set('bitpayAccounts-v2-' + network, allAccounts, function(){ + storage.set('bitpayAccounts-v2-' + network, allAccounts, function() { return cb(err, allAccounts); }); - } else + } else return cb(err, allAccounts); });