Fix wallet deletion without push

Fix a BWS crash when deleting a wallet with push disabled. No need of push unsubscribe when push is disabled. Else this leads to a full crash and stop of BWS server incase it doesn't support push.
This commit is contained in:
antonio-fr 2017-01-02 10:40:17 +01:00 committed by GitHub
commit d1ea109257

View file

@ -480,10 +480,12 @@ angular.module('copayApp.services')
root.deleteWalletClient = function(client, cb) {
var walletId = client.credentials.walletId;
pushNotificationsService.unsubscribe(root.getWallet(walletId), function(err) {
if (err) $log.warn('Unsubscription error: ' + err.message);
else $log.debug('Unsubscribed from push notifications service');
});
var config = configService.getSync();
if (config.pushNotifications.enabled)
pushNotificationsService.unsubscribe(root.getWallet(walletId), function(err) {
if (err) $log.warn('Unsubscription error: ' + err.message);
else $log.debug('Unsubscribed from push notifications service');
});
$log.debug('Deleting Wallet:', client.credentials.walletName);
client.removeAllListeners();