summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Bartelmeß <mba@fourplusone.de>2012-03-14 01:32:16 +0100
committerMatthias Bartelmeß <mba@fourplusone.de>2012-03-14 01:32:16 +0100
commitede32726c186f3bd937801ccf313886248fac622 (patch)
tree6be53f5246393d45fd3d0ae79bf9408f57d5b2dd /src
parent70940521f2cdc3cdb3361bd148e141f43505ee4d (diff)
downloadetherpad-lite-ede32726c186f3bd937801ccf313886248fac622.zip
check if sockets are available in PadMessageHandler
Diffstat (limited to 'src')
-rw-r--r--src/node/handler/PadMessageHandler.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js
index e26bb46e..26748517 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -128,7 +128,11 @@ exports.handleDisconnect = function(client)
//Go trough all user that are still on the pad, and send them the USER_LEAVE message
for(i in pad2sessions[sessionPad])
{
- socketio.sockets.sockets[pad2sessions[sessionPad][i]].json.send(messageToTheOtherUsers);
+ var socket = socketio.sockets.sockets[pad2sessions[sessionPad][i]];
+ if(socket !== undefined){
+ socket.json.send(messageToTheOtherUsers);
+ }
+
}
});
}
@@ -738,9 +742,10 @@ function handleClientReady(client, message)
{
for(var i in pad2sessions[message.padId])
{
- if(sessioninfos[pad2sessions[message.padId][i]].author == author)
+ if(sessioninfos[pad2sessions[message.padId][i]] && sessioninfos[pad2sessions[message.padId][i]].author == author)
{
- socketio.sockets.sockets[pad2sessions[message.padId][i]].json.send({disconnect:"userdup"});
+ var socket = socketio.sockets.sockets[pad2sessions[message.padId][i]];
+ if(socket) socket.json.send({disconnect:"userdup"});
}
}
}