Skip to content

Commit 7c01d48

Browse files
yorkiechrisdickinson
authored andcommitted
stream: remove duplicated expression
Reviewed-by: Trevor Norris <[email protected]> Reviewed-by: Chris Dickinson <[email protected]>
1 parent 7a9b3b3 commit 7c01d48

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/_stream_readable.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
141141
stream.emit('error', er);
142142
} else if (chunk === null) {
143143
state.reading = false;
144-
if (!state.ended)
145-
onEofChunk(stream, state);
144+
onEofChunk(stream, state);
146145
} else if (state.objectMode || chunk && chunk.length > 0) {
147146
if (state.ended && !addToFront) {
148147
var e = new Error('stream.push() after EOF');
@@ -387,7 +386,8 @@ function chunkInvalid(state, chunk) {
387386

388387

389388
function onEofChunk(stream, state) {
390-
if (state.decoder && !state.ended) {
389+
if (state.ended) return;
390+
if (state.decoder) {
391391
var chunk = state.decoder.end();
392392
if (chunk && chunk.length) {
393393
state.buffer.push(chunk);

0 commit comments

Comments
 (0)