From b3c3ee93ce7015734c33da19a5c2e13dcfdbe672 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 21 Aug 2014 14:37:40 -0500 Subject: [PATCH] Hopefully fix an error case I have no idea why it's possible for sock.handshake to be defined and then undefined --- lib/io/ioserver.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/io/ioserver.js b/lib/io/ioserver.js index 09cb12b4..5a2af30e 100644 --- a/lib/io/ioserver.js +++ b/lib/io/ioserver.js @@ -125,6 +125,7 @@ function addTypecheckedFunctions(sock) { */ function handleConnection(sock) { var ip = sock.handshake.address.address; + var sockUser = sock.handshake.user; if (net.isIPv6(ip)) { ip = util.expandIPv6(ip); } @@ -158,10 +159,10 @@ function handleConnection(sock) { addTypecheckedFunctions(sock); var user = new User(sock); - if (sock.handshake.user) { + if (sockUser) { user.setFlag(Flags.U_REGISTERED); user.clearFlag(Flags.U_READY); - user.refreshAccount({ name: sock.handshake.user.name }, + user.refreshAccount({ name: sockUser.name }, function (err, account) { if (err) { user.clearFlag(Flags.U_REGISTERED);