From deba6f3aa1f06db1666fba4205f1b227fc802916 Mon Sep 17 00:00:00 2001 From: Maxime Poulin Date: Sat, 18 Jun 2016 21:01:38 -0400 Subject: [PATCH] Fix crash in public mode introduced by #370 --- src/client.js | 12 ++++++------ src/server.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/client.js b/src/client.js index bdf6c146..003ad3be 100644 --- a/src/client.js +++ b/src/client.js @@ -67,13 +67,13 @@ function Client(manager, name, config) { var client = this; - if (!client.config.token) { - client.updateToken(function() { - client.manager.updateUser(client.name, {token: client.config.token}); - }); - } - if (config) { + if (!config.token) { + client.updateToken(function() { + client.manager.updateUser(client.name, {token: config.token}); + }); + } + var delay = 0; (config.networks || []).forEach(function(n) { setTimeout(function() { diff --git a/src/server.js b/src/server.js index 055bd8d3..6fe09cbf 100644 --- a/src/server.js +++ b/src/server.js @@ -196,7 +196,7 @@ function init(socket, client) { socket.emit("init", { active: client.activeChannel, networks: client.networks, - token: client.config.token + token: client.config ? client.config.token : null }); } }