From d989b6d6e447dc11318c00114456252819e01cc3 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 30 Jan 2019 15:49:07 +0100 Subject: [PATCH] Fix one case of phantom viewers --- www/common/outer/onlyoffice.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/www/common/outer/onlyoffice.js b/www/common/outer/onlyoffice.js index c08135b20..daaf307fd 100644 --- a/www/common/outer/onlyoffice.js +++ b/www/common/outer/onlyoffice.js @@ -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]; };