Fix crash in public mode introduced by #370 (#413)

This commit is contained in:
Pavel Djundik 2016-06-19 10:59:10 +03:00 committed by GitHub
commit f0adee1700
2 changed files with 7 additions and 7 deletions

View File

@ -67,13 +67,13 @@ function Client(manager, name, config) {
var client = this; var client = this;
if (!client.config.token) { if (config) {
if (!config.token) {
client.updateToken(function() { client.updateToken(function() {
client.manager.updateUser(client.name, {token: client.config.token}); client.manager.updateUser(client.name, {token: config.token});
}); });
} }
if (config) {
var delay = 0; var delay = 0;
(config.networks || []).forEach(function(n) { (config.networks || []).forEach(function(n) {
setTimeout(function() { setTimeout(function() {

View File

@ -196,7 +196,7 @@ function init(socket, client) {
socket.emit("init", { socket.emit("init", {
active: client.activeChannel, active: client.activeChannel,
networks: client.networks, networks: client.networks,
token: client.config.token token: client.config ? client.config.token : null
}); });
} }
} }