diff --git a/lib/internal/quic/quic.js b/lib/internal/quic/quic.js index d55603daf1f4..1a24b7f412be 100644 --- a/lib/internal/quic/quic.js +++ b/lib/internal/quic/quic.js @@ -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