Fix one case of phantom viewers

pull/1/head
yflory 6 years ago
parent 7e00d444c0
commit d989b6d6e4

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

Loading…
Cancel
Save