summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-05-17 23:04:14 -0400
committerEliot Horowitz <eliot@10gen.com>2013-05-17 23:04:14 -0400
commitd8b717d3dc9bfb8e5e0a6ffac537ccb6243e4aba (patch)
treedb58dc277d86116655038884acfdac4e0ee88e47
parentd076a2f8c4c3298da444d942184d8fa06cc0c54f (diff)
downloadmongo-d8b717d3dc9bfb8e5e0a6ffac537ccb6243e4aba.tar.gz
SERVER-6400: do not call FieldRef::getPart on non-existant parts
-rw-r--r--src/mongo/db/matcher/expression_leaf.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp
index a1138e67dcc..86f4efbad78 100644
--- a/src/mongo/db/matcher/expression_leaf.cpp
+++ b/src/mongo/db/matcher/expression_leaf.cpp
@@ -68,8 +68,12 @@ namespace mongo {
}
string rest = fieldRef.dottedField( idxPath + 1 );
- StringData next = fieldRef.getPart( idxPath + 1 );
- bool nextIsNumber = isAllDigits( next );
+ StringData next;
+ bool nextIsNumber = false;
+ if ( rest.size() > 0 ){
+ next = fieldRef.getPart( idxPath + 1 );
+ nextIsNumber = isAllDigits( next );
+ }
BSONObjIterator i( e.Obj() );
while ( i.more() ) {