[SERVER-20585] Coverity analysis defect 73688: Redundant test Created: 23/Sep/15  Updated: 08/Oct/15  Resolved: 23/Sep/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.1.9

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QuInt A (10/12/15)
Participants:

 Description   

Test always evaluates the same

Defect 73688 (STATIC_C)
Checker DEADCODE (subcategory redundant_test)
File: /src/mongo/db/commands/geo_near_cmd.cpp
Function mongo::Geo2dFindNearCmd::run(mongo::OperationContext *, const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, mongo::BSONObj &, int, std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, mongo::BSONObjBuilder &)
/src/mongo/db/commands/geo_near_cmd.cpp, line: 104
Condition "collection", taking true branch. Now the value of "collection" is not "NULL".

            if (!collection) {

/src/mongo/db/commands/geo_near_cmd.cpp, line: 284
At condition "collection", the value of "collection" cannot be "NULL".

            if (collection) {

/src/mongo/db/commands/geo_near_cmd.cpp, line: 284
The condition "collection" must be true.

            if (collection) {



 Comments   
Comment by Githook User [ 23/Sep/15 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-20585 Remove redundant null check
Branch: master
https://github.com/mongodb/mongo/commit/cd970be96ee838d58b6adaec19d7e1267f5e65a3

Generated at Thu Feb 08 03:54:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.