Skip to content

Commit fe48934

Browse files
authored
check return value in mongoc_collection_edc (#768)
1 parent a9afdeb commit fe48934

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libmongoc/src/mongoc/mongoc-collection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ mongoc_collection_estimated_document_count (
905905
ret = mongoc_collection_read_command_with_opts (
906906
coll, &cmd, read_prefs, opts, reply_ptr, error);
907907

908-
if (error && error->code == MONGOC_ERROR_COLLECTION_DOES_NOT_EXIST) {
908+
if (!ret && error->code == MONGOC_ERROR_COLLECTION_DOES_NOT_EXIST) {
909909
/* Collection does not exist. From spec: return 0 but no err:
910910
* https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#estimateddocumentcount
911911
*/

0 commit comments

Comments
 (0)