diff options
author | Diego RodrÃguez Baquero <diegorbaquero@gmail.com> | 2016-06-12 00:34:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-12 00:34:44 +0300 |
commit | 4ca41659d2c1e635260e4f40716e436387b3b77c (patch) | |
tree | 655cb4e31787dc319e171e4001ad719a84ea49b6 /lib | |
parent | 380c48f28b33457265d5433ec6ad8a6cf908df9d (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.js | 2 |
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)) } } |