diff --git a/lib/channel/channel.js b/lib/channel/channel.js index 425983cc..106cfdac 100644 --- a/lib/channel/channel.js +++ b/lib/channel/channel.js @@ -360,6 +360,11 @@ Channel.prototype.acceptUser = function (user) { }; Channel.prototype.partUser = function (user) { + if (!this.logger) { + Logger.errlog.log("partUser called on dead channel"); + return; + } + this.logger.log("[login] " + user.longip + " (" + user.getName() + ") " + "disconnected."); user.channel = null; diff --git a/lib/channel/chat.js b/lib/channel/chat.js index 52eca4b8..40ab4ced 100644 --- a/lib/channel/chat.js +++ b/lib/channel/chat.js @@ -108,7 +108,7 @@ ChatModule.prototype.shadowMutedUsers = function () { ChatModule.prototype.handleChatMsg = function (user, data) { var self = this; - if (!this.channel.modules.permissions.canChat(user)) { + if (!this.channel || !this.channel.modules.permissions.canChat(user)) { return; } @@ -135,6 +135,10 @@ ChatModule.prototype.handleChatMsg = function (user, data) { }; ChatModule.prototype.handlePm = function (user, data) { + if (!this.channel) { + return; + } + var reallyTo = data.to; data.to = data.to.toLowerCase();