From 7d746afd02264f30e766caff7183bd2a8961c27d Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Mon, 3 May 2021 09:16:57 -0400 Subject: SERVER-55977 fix coverity analysis defect 118057: unchecked return value --- src/mongo/db/timeseries/bucket_catalog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mongo/db/timeseries/bucket_catalog.cpp b/src/mongo/db/timeseries/bucket_catalog.cpp index 2aebb3f9af2..6daf97c95e5 100644 --- a/src/mongo/db/timeseries/bucket_catalog.cpp +++ b/src/mongo/db/timeseries/bucket_catalog.cpp @@ -39,6 +39,7 @@ #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/operation_context.h" #include "mongo/db/views/view_catalog.h" +#include "mongo/platform/compiler.h" #include "mongo/stdx/thread.h" #include "mongo/util/fail_point.h" @@ -1235,7 +1236,8 @@ BSONObj BucketCatalog::MinMax::minUpdates() { invariant(_min.type() == Type::kObject); BSONObjBuilder builder; - _appendUpdates(&builder, GetMin()); + // Return constructed document even if empty. + MONGO_COMPILER_VARIABLE_UNUSED auto appended = _appendUpdates(&builder, GetMin()); return builder.obj(); } @@ -1243,7 +1245,8 @@ BSONObj BucketCatalog::MinMax::maxUpdates() { invariant(_max.type() == Type::kObject); BSONObjBuilder builder; - _appendUpdates(&builder, GetMax()); + // Return constructed document even if empty. + MONGO_COMPILER_VARIABLE_UNUSED auto appended = _appendUpdates(&builder, GetMax()); return builder.obj(); } -- cgit v1.2.1