summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/query.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/db/query.cpp b/db/query.cpp
index 5bd7b00ac2a..1cbf97d4be9 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -787,8 +787,10 @@ namespace mongo {
if ( _pq.isExplain()) {
_eb.noteScan( _c.get(), _nscanned, _nscannedObjects, _n, scanAndOrderRequired(), _curop.elapsedMillis(), useHints && !_pq.getHint().eoo() );
} else {
- _response.appendData( _buf.buf(), _buf.len() );
- _buf.decouple();
+ if (_buf.len()) {
+ _response.appendData( _buf.buf(), _buf.len() );
+ _buf.decouple();
+ }
}
if ( stop ) {
setStop();