Commit 757e685
stream: remove
`validChunk` allowed `undefined` as a chunk in object mode; however,
this was redundant, since:
- `validChunk()` is only used by `.write()`
- If the `validChunk()` check passes for `undefined`, `.write()`
calls `writeOrBuffer()`
- If `writeOrBuffer()` does not receive a Buffer, it calls
`decodeChunk()`
- `decodeChunk()` ignores `undefined` because it checks
`typeof chunk === 'string'`
- After that call, `chunk.length` is accessed, which throws an
error if `chunk` is undefined`.
This “fixes” a bug in the sense that `state.pendingcb` is no longer
incremented for write attempts that fail like this.
PR-URL: #17644
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jon Moss <[email protected]>undefined check1 parent 6d9b1e4 commit 757e685
1 file changed
+1
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
| 252 | + | |
255 | 253 | | |
256 | 254 | | |
257 | 255 | | |
| |||
0 commit comments