Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 5f4bd90

Browse files
committed
Doc::destroy: fix call to this inside error case of async callback
1 parent f36fc81 commit 5f4bd90

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/client/doc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ Doc.prototype.destroy = function(callback) {
107107
if (doc.wantSubscribe) {
108108
doc.unsubscribe(function(err) {
109109
if (err) {
110-
if (callback) callback(err);
111-
else this.emit('error', err);
112-
return;
110+
if (callback) return callback(err);
111+
return doc.emit('error', err);
113112
}
114113
doc.connection._destroyDoc(doc);
115114
if (callback) callback();

0 commit comments

Comments
 (0)