Add checks for dead channels

This commit is contained in:
Calvin Montgomery 2014-05-20 20:59:36 -07:00
parent 705b8ce10a
commit 5f0d2db1be
2 changed files with 10 additions and 1 deletions

View file

@ -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;

View file

@ -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();