Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit cfcb1de

Browse files
yorkiechrisdickinson
authored andcommitted
stream: remove duplicated expression
Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
1 parent 25702ab commit cfcb1de

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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)