summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2019-02-25 17:19:17 -0500
committerJason Carey <jcarey@argv.me>2019-03-12 16:36:56 -0400
commit091b3c02c03d59db32809ade8264e163adc12cd2 (patch)
tree84e1e8397ad85f9f27365c27378d56ce0f433fe8
parent701cf71ba3e8ffa706bfb49d3ea2d44dc1654126 (diff)
downloadmongo-091b3c02c03d59db32809ade8264e163adc12cd2.tar.gz
SERVER-39303 Fix several useless Client* checks
The checks performed in functions that are never passed a nullptr and would crash later if null was ever passed. Removing the checks makes coverity happy. (cherry picked from commit e61f7582788f51b2287f179c8f27ec8fa41744f7)
-rw-r--r--src/mongo/db/service_context.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp
index 0930c9c9a61..7d64f9c5a2a 100644
--- a/src/mongo/db/service_context.cpp
+++ b/src/mongo/db/service_context.cpp
@@ -241,7 +241,7 @@ void ServiceContext::ClientDeleter::operator()(Client* client) const {
ServiceContext::UniqueOperationContext ServiceContext::makeOperationContext(Client* client) {
auto opCtx = std::make_unique<OperationContext>(client, _nextOpId.fetchAndAdd(1));
- if (client && client->session()) {
+ if (client->session()) {
_numCurrentOps.addAndFetch(1);
}
@@ -262,7 +262,7 @@ ServiceContext::UniqueOperationContext ServiceContext::makeOperationContext(Clie
void ServiceContext::OperationContextDeleter::operator()(OperationContext* opCtx) const {
auto client = opCtx->getClient();
- if (client && client->session()) {
+ if (client->session()) {
_numCurrentOps.subtractAndFetch(1);
}
auto service = client->getServiceContext();