fix(ext/node): add null check for kStreamBaseField (#26368)

It's not guaranteed that `kStreamBaseField` is not undefined, so
added a check for it.

Closes https://github.com/denoland/deno/issues/26363
This commit is contained in:
Bartek Iwańczuk 2024-10-17 23:57:05 +01:00 committed by GitHub
parent 02e5a7a012
commit 8f3eb9d0e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -300,7 +300,7 @@ export class TCP extends ConnectionWrap {
* @return An error status code.
*/
setNoDelay(noDelay: boolean): number {
if ("setNoDelay" in this[kStreamBaseField]) {
if (this[kStreamBaseField] && "setNoDelay" in this[kStreamBaseField]) {
this[kStreamBaseField].setNoDelay(noDelay);
}
return 0;