summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYazhong Liu <yorkiefixer@gmail.com>2014-10-03 00:00:40 +0800
committerChris Dickinson <christopher.s.dickinson@gmail.com>2014-10-09 12:02:28 -0500
commitcfcb1de130867197cbc9c6012b7e84e08e53d032 (patch)
tree02b9e4faf8aeb65da48dc4ff98280a2a87a3907a /lib
parent25702abc5638bbecffa92e8349d2a871a5f592c9 (diff)
downloadnode-new-cfcb1de130867197cbc9c6012b7e84e08e53d032.tar.gz
stream: remove duplicated expression
Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/_stream_readable.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index c691137374..496421b339 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -141,8 +141,7 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
stream.emit('error', er);
} else if (chunk === null) {
state.reading = false;
- if (!state.ended)
- onEofChunk(stream, state);
+ onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (state.ended && !addToFront) {
var e = new Error('stream.push() after EOF');
@@ -387,7 +386,8 @@ function chunkInvalid(state, chunk) {
function onEofChunk(stream, state) {
- if (state.decoder && !state.ended) {
+ if (state.ended) return;
+ if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);