fix race condition at push service

This commit is contained in:
Matias Alejo Garcia 2018-01-17 21:12:56 -03:00
parent 1d629c5674
commit ff89650337
No known key found for this signature in database
GPG Key ID: 02470DB551277AB3
1 changed files with 2 additions and 2 deletions

View File

@ -189,7 +189,7 @@ PushNotificationsService.prototype._checkShouldSendNotif = function(notification
if (notification.type != 'NewTxProposal') return cb(null, true);
self.storage.fetchWallet(notification.walletId, function(err, wallet) {
return cb(err, wallet.m > 1);
return cb(err, wallet && wallet.m > 1);
});
};
@ -297,7 +297,7 @@ PushNotificationsService.prototype._getDataForTemplate = function(notification,
}
self.storage.fetchWallet(notification.walletId, function(err, wallet) {
if (err) return cb(err);
if (err || !wallet) return cb(err);
data.walletId = wallet.id;
data.walletName = wallet.name;