From 0f559347eee8857ea7ecc36f595d8bc872a7dabc Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Wed, 19 Oct 2011 21:48:36 +0200 Subject: [PATCH] Fixing a bug that happens when a socket.io connection closes very early after a CLIENT_READY message --- node/handler/PadMessageHandler.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/node/handler/PadMessageHandler.js b/node/handler/PadMessageHandler.js index f89f4934c..438f0ff36 100644 --- a/node/handler/PadMessageHandler.js +++ b/node/handler/PadMessageHandler.js @@ -809,10 +809,15 @@ function handleClientReady(client, message) //Send the clientVars to the Client client.json.send(clientVars); - //Save the revision and the author id in sessioninfos - sessioninfos[client.id].rev = pad.getHeadRevisionNumber(); - sessioninfos[client.id].author = author; - + //sometimes the client disconnects very early and the session of it is already removed + //thats why we have to check that case + if(sessioninfos[client.id] !== undefined) + { + //Save the revision and the author id in sessioninfos + sessioninfos[client.id].rev = pad.getHeadRevisionNumber(); + sessioninfos[client.id].author = author; + } + //prepare the notification for the other users on the pad, that this user joined var messageToTheOtherUsers = { "type": "COLLABROOM",