From 51d0808c908f33db34382024b8011d27e0943fa7 Mon Sep 17 00:00:00 2001 From: Yazhong Liu Date: Fri, 3 Oct 2014 00:00:40 +0800 Subject: [PATCH] stream: remove duplicated expression PR-URL: https://github.com/iojs/io.js/pull/1444 Reviewed-By: Trevor Norris Reviewed-By: Chris Dickinson Reviewed-By: Jeremiah Senkpiel --- lib/_stream_readable.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 5600218..1de5559 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -125,8 +125,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'); @@ -372,7 +371,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); -- 2.7.4