From d1ea1092572ac3b1b07e2989e3bcfd3e28d51272 Mon Sep 17 00:00:00 2001 From: antonio-fr Date: Mon, 2 Jan 2017 10:40:17 +0100 Subject: [PATCH] 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. --- src/js/services/profileService.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index d5de455b6..ffd4b7001 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -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();