Skip to content

Commit

Permalink
fix(cursor): close readable on null response for dead cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Aug 30, 2017
1 parent 6bb7e33 commit 6aca2c5
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 162 deletions.
7 changes: 7 additions & 0 deletions lib/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,13 @@ Cursor.prototype._read = function() {
return self.emit('finish');
}

if (result === null && self.isDead()) {
self.close();
self.emit('end');
self.emit('finish');
return;
}

// If we provided a transformation method
if(typeof self.s.streamOptions.transform == 'function' && result != null) {
return self.push(self.s.streamOptions.transform(result));
Expand Down
Loading

0 comments on commit 6aca2c5

Please sign in to comment.