From f6e6099718a54c3f3a68bd16f28024923b8bdf81 Mon Sep 17 00:00:00 2001 From: Jen Wei Date: Tue, 12 May 2020 11:25:49 -0700 Subject: [PATCH] Add missing callback error handling In queryPollDoc(), the callback for getCollectionPoll() does not have any error handling Thus, when collection is undefined and an error is returned, we hit a TypeError when we try to call find() on collection --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 1816a347..092abb0f 100644 --- a/index.js +++ b/index.js @@ -829,6 +829,7 @@ ShareDbMongo.prototype.queryPoll = function(collectionName, inputQuery, options, ShareDbMongo.prototype.queryPollDoc = function(collectionName, id, inputQuery, options, callback) { var self = this; self.getCollectionPoll(collectionName, function(err, collection) { + if (err) return callback(err); var parsed = self._getSafeParsedQuery(inputQuery, callback); if (!parsed) return;