Patch userLeave bug (Issue#14

This commit is contained in:
calzoneman 2013-03-23 21:05:13 -05:00
parent ecc4fb3951
commit 516edf690d
2 changed files with 4 additions and 3 deletions

View file

@ -326,7 +326,10 @@ Channel.prototype.userLeave = function(user) {
if(this.leader == user) {
this.changeLeader("");
}
this.users.splice(this.users.indexOf(user), 1);
var idx = this.users.indexOf(user);
if(idx >= 0 && idx < this.users.length)
this.users.splice(idx, 1);
console.log(this.users.length);
this.updateUsercount();
if(user.name != "") {
this.sendAll('userLeave', {

View file

@ -33,7 +33,6 @@ function handleKick(chan, user, args) {
}
if(kickee) {
kickee.socket.disconnect();
chan.userLeave(kickee);
}
}
}
@ -50,7 +49,6 @@ function handleBan(chan, user, args) {
if(kickee) {
chan.ipbans.push(kickee.ip);
kickee.socket.disconnect();
chan.userLeave(kickee);
}
}
}