summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-10-15 14:35:47 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-10-15 14:35:52 -0400
commit487d9e61dba245cfb58af084b802ee4fc41e6288 (patch)
treea0479ddd141550133a3d54f8bd8dcb1d65abfcd1
parent2a1753c33971126e48705d0364a99977e30f5559 (diff)
downloadmongo-487d9e61dba245cfb58af084b802ee4fc41e6288.tar.gz
don't crash when checking to see if we can use a 2d query and there is no collection
-rw-r--r--src/mongo/db/query/new_find.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/query/new_find.cpp b/src/mongo/db/query/new_find.cpp
index 91d1fac31c5..0fd08776730 100644
--- a/src/mongo/db/query/new_find.cpp
+++ b/src/mongo/db/query/new_find.cpp
@@ -119,6 +119,7 @@ namespace mongo {
CanonicalQuery* cq;
Status status = CanonicalQuery::canonicalize(qm, &cq);
if (!status.isOK()) { return false; }
+ verify(cq);
auto_ptr<CanonicalQuery> scopedCq(cq);
const LiteParsedQuery& pq = cq->getParsed();
@@ -161,7 +162,11 @@ namespace mongo {
if (QueryPlannerCommon::hasNode(cq->root(), MatchExpression::GEO_NEAR, &nearNode)) {
GeoNearMatchExpression* gnme = static_cast<GeoNearMatchExpression*>(nearNode);
NamespaceDetails* nsd = nsdetails(cq->ns().c_str());
- if (NULL == nsd) { return true; }
+ if (NULL == nsd) {
+ // Will create an EOFRunner.
+ *cqOut = scopedCq.release();
+ return true;
+ }
for (int i = 0; i < nsd->getCompletedIndexCount(); ++i) {
auto_ptr<IndexDescriptor> desc(CatalogHack::getDescriptor(nsd, i));
BSONObjIterator kpIt(desc->keyPattern());