summaryrefslogtreecommitdiff
path: root/lib/_stream_readable.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_stream_readable.js')
-rw-r--r--lib/_stream_readable.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 7502a1ac2c..2dc1323f09 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -490,9 +490,10 @@ Readable.prototype.read = function(n) {
debug('length less than watermark', doRead);
}
- // However, if we've ended, then there's no point, and if we're already
- // reading, then it's unnecessary.
- if (state.ended || state.reading) {
+ // However, if we've ended, then there's no point, if we're already
+ // reading, then it's unnecessary, and if we're destroyed, then it's
+ // not allowed.
+ if (state.ended || state.reading || state.destroyed) {
doRead = false;
debug('reading or ended', doRead);
} else if (doRead) {