Fix one case of phantom viewers

This commit is contained in:
yflory 2019-01-30 15:49:07 +01:00
parent 7e00d444c0
commit d989b6d6e4

View File

@ -205,12 +205,14 @@ define([
}
}
var oldChannel = ctx.clients[clientId].channel;
var oldChan = ctx.channels[oldChannel];
if (oldChan) {
ctx.emit('LEAVE', {id: clientId}, [oldChan.clients[0]]);
if (ctx.clients[clientId]) {
var oldChannel = ctx.clients[clientId].channel;
var oldChan = ctx.channels[oldChannel];
if (oldChan) {
ctx.emit('LEAVE', {id: clientId}, [oldChan.clients[0]]);
}
delete ctx.clients[clientId];
}
delete ctx.clients[clientId];
};