Skip to content

Commit e2558f0

Browse files
committed
net: fix error details in connect()
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]>
1 parent 4af5746 commit e2558f0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/net.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,13 @@ function connect(self, address, port, addressType, localAddress, localPort) {
813813
}
814814

815815
if (err) {
816-
self._getsockname();
816+
var sockname = self._getsockname();
817817
var details;
818-
if (self._sockname) {
819-
ex.localAddress = self._sockname.address;
820-
ex.localPort = self._sockname.port;
821-
details = ex.localAddress + ':' + ex.localPort;
818+
819+
if (sockname) {
820+
details = sockname.address + ':' + sockname.port;
822821
}
822+
823823
var ex = exceptionWithHostPort(err, 'connect', address, port, details);
824824
self._destroy(ex);
825825
}

0 commit comments

Comments
 (0)