Skip to content

Commit

Permalink
net: fix error details in connect()
Browse files Browse the repository at this point in the history
3ac4941 introduced a
bug as it attempted to access properties of an
undefined variable. This commit cleans up the offending
code.

Fixes: #510
PR-URL: #514
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
cjihrig committed Jan 19, 2015
1 parent 4af5746 commit e2558f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,13 +813,13 @@ function connect(self, address, port, addressType, localAddress, localPort) {
}

if (err) {
self._getsockname();
var sockname = self._getsockname();
var details;
if (self._sockname) {
ex.localAddress = self._sockname.address;
ex.localPort = self._sockname.port;
details = ex.localAddress + ':' + ex.localPort;

if (sockname) {
details = sockname.address + ':' + sockname.port;
}

var ex = exceptionWithHostPort(err, 'connect', address, port, details);
self._destroy(ex);
}
Expand Down

0 comments on commit e2558f0

Please sign in to comment.