Do not crash when awayMessage is set but IRC connection does not

This commit is contained in:
Pavel Djundik 2018-03-09 12:33:24 +02:00 committed by GitHub
parent 218e06fbd4
commit b5b0ebe00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -542,7 +542,7 @@ Client.prototype.clientAttach = function(socketId, token) {
client.networks.forEach(function(network) { client.networks.forEach(function(network) {
// Only remove away on client attachment if // Only remove away on client attachment if
// there is no away message on this network // there is no away message on this network
if (!network.awayMessage) { if (network.irc && !network.awayMessage) {
network.irc.raw("AWAY"); network.irc.raw("AWAY");
} }
}); });
@ -584,7 +584,7 @@ Client.prototype.clientDetach = function(socketId) {
client.networks.forEach(function(network) { client.networks.forEach(function(network) {
// Only set away on client deattachment if // Only set away on client deattachment if
// there is no away message on this network // there is no away message on this network
if (!network.awayMessage) { if (network.irc && !network.awayMessage) {
network.irc.raw("AWAY", client.awayMessage); network.irc.raw("AWAY", client.awayMessage);
} }
}); });