Skip to content

Commit 23a127e

Browse files
committed
fix: check for null before destroy
1 parent 5829301 commit 23a127e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ class ProxyResponseHandler {
397397
}
398398

399399
_release () {
400+
if (this.proxyRes) {
401+
this.proxyRes.destroy()
402+
}
403+
400404
this.req = null
401405
this.resOrSocket = null
402406
this.onRes = null
@@ -471,8 +475,12 @@ class ProxyUpgradeHandler {
471475
}
472476

473477
_release () {
474-
this.proxyRes.destroy()
475-
this.proxySocket.destroy()
478+
if (this.proxyRes) {
479+
this.proxyRes.destroy()
480+
}
481+
if (this.proxySocket) {
482+
this.proxySocket.destroy()
483+
}
476484

477485
this.req = null
478486
this.resOrSocket = null

0 commit comments

Comments
 (0)