Permalink
Browse files

don't advance iterator if empty/at end for geo cursor SERVER-3428

  • Loading branch information...
1 parent 1b048c3 commit e6299cf1d1dd63ebda4fd4cd2a7e52de21c8a90a gregs committed Jul 14, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 db/geo/2d.cpp
View
@@ -1125,7 +1125,14 @@ namespace mongo {
virtual Record* _current() { assert(ok()); return _cur->_loc.rec(); }
virtual BSONObj current() { assert(ok()); return _cur->_o; }
virtual DiskLoc currLoc() { assert(ok()); return _cur->_loc; }
- virtual bool advance() { _cur++; incNscanned(); return ok(); }
+ virtual bool advance() {
+ bool isOk = ok();
+ if( isOk ){
+ _cur++;
+ incNscanned();
+ }
+ return isOk;
+ }
virtual BSONObj currKey() const { return _cur->_key; }
virtual string toString() {

0 comments on commit e6299cf

Please sign in to comment.