From 06c36f3023404f0950e03db028bc9887a24ecdff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Tue, 22 May 2012 09:31:28 +0200 Subject: [PATCH] fix #722 by better argument checking in PadMessageHandler.js --- src/node/handler/PadMessageHandler.js | 44 ++++++++++++--------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 4a570e219..3f6cfa56a 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -177,31 +177,25 @@ exports.handleMessage = function(client, message) { handleClientReady(client, message); } - else if(message.type == "COLLABROOM" && - message.data.type == "USER_CHANGES") - { - handleUserChanges(client, message); - } - else if(message.type == "COLLABROOM" && - message.data.type == "USERINFO_UPDATE") - { - handleUserInfoUpdate(client, message); - } - else if(message.type == "COLLABROOM" && - message.data.type == "CHAT_MESSAGE") - { - handleChatMessage(client, message); - } - else if(message.type == "COLLABROOM" && - message.data.type == "SAVE_REVISION") - { - handleSaveRevisionMessage(client, message); - } - else if(message.type == "COLLABROOM" && - message.data.type == "CLIENT_MESSAGE" && - message.data.payload.type == "suggestUserName") - { - handleSuggestUserName(client, message); + else if(message.type == "COLLABROOM" && typeof message.data == 'object'){ + if (message.data.type == "USER_CHANGES") + { + handleUserChanges(client, message); + } + else if (message.data.type == "USERINFO_UPDATE") + { + handleUserInfoUpdate(client, message); + } + else if(message.data.type == "CHAT_MESSAGE") + { + handleChatMessage(client, message); + } + else if(message.data.type == "CLIENT_MESSAGE" && + typeof message.data.payload == 'object' && + message.data.payload.type == "suggestUserName") + { + handleSuggestUserName(client, message); + } } //if the message type is unknown, throw an exception else