Merge pull request #1431 from mluto/fix-userinfo-crash

Fix USERINFO_UPDATE crash
pull/1432/merge
John McLear 2013-01-30 06:43:37 -08:00
commit 1814c756ad
1 changed files with 6 additions and 0 deletions

View File

@ -210,6 +210,7 @@ exports.handleMessage = function(client, message)
} else if (message.data.type == "SAVE_REVISION") {
handleSaveRevisionMessage(client, message);
} else if (message.data.type == "CLIENT_MESSAGE" &&
message.data.payload != null &&
message.data.payload.type == "suggestUserName") {
handleSuggestUserName(client, message);
} else {
@ -473,6 +474,11 @@ function handleSuggestUserName(client, message)
function handleUserInfoUpdate(client, message)
{
//check if all ok
if(message.data.userInfo == null)
{
messageLogger.warn("Dropped message, USERINFO_UPDATE Message has no userInfo!");
return;
}
if(message.data.userInfo.colorId == null)
{
messageLogger.warn("Dropped message, USERINFO_UPDATE Message has no colorId!");