Skip to content

Commit 51d0808

Browse files
yorkieFishrock123
authored andcommitted
stream: remove duplicated expression
PR-URL: #1444 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Chris Dickinson <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 3ad82c3 commit 51d0808

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/_stream_readable.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
125125
stream.emit('error', er);
126126
} else if (chunk === null) {
127127
state.reading = false;
128-
if (!state.ended)
129-
onEofChunk(stream, state);
128+
onEofChunk(stream, state);
130129
} else if (state.objectMode || chunk && chunk.length > 0) {
131130
if (state.ended && !addToFront) {
132131
var e = new Error('stream.push() after EOF');
@@ -372,7 +371,8 @@ function chunkInvalid(state, chunk) {
372371

373372

374373
function onEofChunk(stream, state) {
375-
if (state.decoder && !state.ended) {
374+
if (state.ended) return;
375+
if (state.decoder) {
376376
var chunk = state.decoder.end();
377377
if (chunk && chunk.length) {
378378
state.buffer.push(chunk);

0 commit comments

Comments
 (0)