Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDiego Rodríguez Baquero <diegorbaquero@gmail.com>2016-06-12 00:34:44 +0300
committerGitHub <noreply@github.com>2016-06-12 00:34:44 +0300
commit4ca41659d2c1e635260e4f40716e436387b3b77c (patch)
tree655cb4e31787dc319e171e4001ad719a84ea49b6 /lib
parent380c48f28b33457265d5433ec6ad8a6cf908df9d (diff)
Update tcp-pool.js
Prevent arrayRemove if the pool is already destroyed. Fixes possible error `TypeError: Cannot read property 'indexOf' of null`
Diffstat (limited to 'lib')
-rw-r--r--lib/tcp-pool.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tcp-pool.js b/lib/tcp-pool.js
index 5e15d0a..b478810 100644
--- a/lib/tcp-pool.js
+++ b/lib/tcp-pool.js
@@ -119,7 +119,7 @@ TCPPool.prototype._onConnection = function (conn) {
function cleanupPending () {
conn.removeListener('close', cleanupPending)
wire.removeListener('handshake', onHandshake)
- arrayRemove(self._pendingConns, self._pendingConns.indexOf(conn))
+ if(self._pendingConns) arrayRemove(self._pendingConns, self._pendingConns.indexOf(conn))
}
}