diff --git a/lib/tcp-pool.js b/lib/tcp-pool.js index 5e15d0a3..b478810e 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)) } }