quic: fix crash in onStreamClose

onStreamClose could crash, if this[kOwner]
was not set.

Signed-off-by: Marten Richter <marten.richter@freenet.de>
PR-URL: https://github.com/nodejs/node/pull/65861
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
This commit is contained in:
Marten Richter authored and GitHub committed 2026-09-08 17:43:27 +00:00
1 parent e4186d6942
commit ee354929da
1 file changed
+2 -1
+2 -1
View File
@@ -962,9 +962,10 @@ setCallbacks({
// Called when the stream C++ handle has been closed. The error is
// either undefined (clean close) or a raw array [type, code, reason]
// from QuicError::ToV8Value. Convert to a proper Node.js Error.
if (!this[kOwner]) return;
if (error !== undefined) {
error = convertQuicError(error);
} else if (this[kOwner] && !this[kOwner].destroyed) {
} else if (!this[kOwner].destroyed) {
// The stream is closing cleanly, but it may have been reset by the
// peer (ReceiveStreamReset) or locally (resetStream). The C++ side
// records the reset code in state.resetCode. If set, surface the