From 8b3514d876d9b9584c45b4a765cf7344f3479b25 Mon Sep 17 00:00:00 2001 From: jz <582151+jiazheng@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:16:03 +0800 Subject: [PATCH] request may be null when _handleSubscribe called. fix it. --- lib/client/doc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client/doc.js b/lib/client/doc.js index 7bb47c33f..27bf0452a 100644 --- a/lib/client/doc.js +++ b/lib/client/doc.js @@ -311,7 +311,7 @@ Doc.prototype._handleSubscribe = function(error, snapshot) { this.inflightSubscribe = null; var callbacks = this.pendingFetch; this.pendingFetch = []; - if (request.callback) callbacks.push(request.callback); + if (request && request.callback) callbacks.push(request.callback); var callback; if (callbacks.length) { callback = function(error) { @@ -319,7 +319,7 @@ Doc.prototype._handleSubscribe = function(error, snapshot) { }; } if (error) return this._emitResponseError(error, callback); - this.subscribed = request.wantSubscribe; + this.subscribed = request && request.wantSubscribe; if (this.subscribed) this.ingestSnapshot(snapshot, callback); else if (callback) callback(); this._emitNothingPending();