From 5f0d2db1be0e324090de64ef22cc0f7bd15449d6 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Tue, 20 May 2014 20:59:36 -0700 Subject: [PATCH] Add checks for dead channels --- lib/channel/channel.js | 5 +++++ lib/channel/chat.js | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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();