peer: fix potential error.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Christopher Jeffrey 2014-05-17 01:50:44 -05:00 committed by Fedor Indutny
parent b2c4af302d
commit e9ec9a5f0c

View File

@ -355,7 +355,7 @@ Peer.prototype._handleGetAddr = function handleGetAddr() {
port: peer.socket.remotePort || 8333
};
}).filter(function(peer) {
if (~used.indexOf(peer.host)) return;
if (!peer || ~used.indexOf(peer.host)) return;
used.push(peer.host);
return !!peer.host && net.isIP(peer.host);
}).map(function(peer) {