Skip to content

Commit

Permalink
Doc::destroy: fix call to this inside error case of async callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nateps committed Jul 23, 2018
1 parent f36fc81 commit 5f4bd90
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/client/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ Doc.prototype.destroy = function(callback) {
if (doc.wantSubscribe) {
doc.unsubscribe(function(err) {
if (err) {
if (callback) callback(err);
else this.emit('error', err);
return;
if (callback) return callback(err);
return doc.emit('error', err);
}
doc.connection._destroyDoc(doc);
if (callback) callback();
Expand Down

0 comments on commit 5f4bd90

Please sign in to comment.