Skip to content

Commit 0631e09

Browse files
committed
CDRIVER-4290 check for null server stream in _mongoc_cursor_fetch_stream (#945)
1 parent 5bb9926 commit 0631e09

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libmongoc/src/mongoc/mongoc-cursor.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,11 @@ _mongoc_cursor_fetch_stream (mongoc_cursor_t *cursor)
664664
cursor->client_session,
665665
&reply,
666666
&cursor->error);
667-
/* Also restore whether primary read preference was forced by server
668-
* selection */
669-
server_stream->must_use_primary = cursor->must_use_primary;
667+
if (server_stream) {
668+
/* Also restore whether primary read preference was forced by server
669+
* selection */
670+
server_stream->must_use_primary = cursor->must_use_primary;
671+
}
670672
} else {
671673
server_stream =
672674
mongoc_cluster_stream_for_reads (&cursor->client->cluster,

0 commit comments

Comments
 (0)