From 2e92786bf024201c3c2c4ef5eca32efd1f656ea2 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Mon, 20 May 2019 14:12:35 +0200 Subject: [PATCH] handle unexpected disconnect flow --- bin/utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/utils.js b/bin/utils.js index 89d226f..3f8e9cc 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -72,8 +72,10 @@ class WSSharedDoc extends Y.Doc { const changedClients = added.concat(updated, removed) if (conn !== null) { const connControlledIDs = /** @type {Set} */ (this.conns.get(conn)) - added.forEach(clientID => { connControlledIDs.add(clientID) }) - removed.forEach(clientID => { connControlledIDs.delete(clientID) }) + if (connControlledIDs !== undefined) { + added.forEach(clientID => { connControlledIDs.add(clientID) }) + removed.forEach(clientID => { connControlledIDs.delete(clientID) }) + } } // broadcast awareness update const encoder = encoding.createEncoder()