From 0677840feebf200036902bbacfd532fa5ee2054c Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 17 Aug 2022 11:52:37 -0400 Subject: [PATCH] fix(NODE-4429): check for null topology --- src/mongo_client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mongo_client.ts b/src/mongo_client.ts index 8f457cdb5a..d980f3e792 100644 --- a/src/mongo_client.ts +++ b/src/mongo_client.ts @@ -501,6 +501,9 @@ export class MongoClient extends TypedEventEmitter { Promise.all(activeSessionEnds) .then(() => { + if (this.topology == null) { + return; + } // If we would attempt to select a server and get nothing back we short circuit // to avoid the server selection timeout. const selector = readPreferenceServerSelector(ReadPreference.primaryPreferred);