diff --git a/lib/Browser.js b/lib/Browser.js index b9df27d..1491d06 100644 --- a/lib/Browser.js +++ b/lib/Browser.js @@ -110,7 +110,7 @@ Browser.prototype.stop = function () { // because resolver.stop()'s will trigger serviceDown: this.removeAllListeners('serviceDown'); Object.values(this._resolvers).forEach(function (resolver) { - return resolver.stop(); + return resolver && resolver.stop(); }); this._state = STATE.STOPPED; @@ -258,4 +258,4 @@ Browser.prototype._addService = function (answer, additionals) { resolver.start(additionals); }; -module.exports = Browser; \ No newline at end of file +module.exports = Browser; diff --git a/src/Browser.js b/src/Browser.js index 097d591..31915fc 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -104,7 +104,7 @@ Browser.prototype.stop = function() { // because resolver.stop()'s will trigger serviceDown: this.removeAllListeners('serviceDown'); - Object.values(this._resolvers).forEach(resolver => resolver.stop()); + Object.values(this._resolvers).forEach(resolver => resolver && resolver.stop()); this._state = STATE.STOPPED; this._resolvers = {};