Merge pull request #2675 from cboylan/userInfoUpdate-guards

Check for valid session in handleUserInfoUpdate
pull/2710/head
John McLear 2015-06-25 01:31:07 +01:00
commit 85d44c8a4e
1 changed files with 10 additions and 2 deletions

View File

@ -544,14 +544,22 @@ function handleUserInfoUpdate(client, message)
return; return;
} }
// Check that we have a valid session and author to update.
var session = sessioninfos[client.id];
if(!session || !session.author || !session.padId)
{
messageLogger.warn("Dropped message, USERINFO_UPDATE Session not ready." + message.data);
return;
}
//Find out the author name of this session //Find out the author name of this session
var author = sessioninfos[client.id].author; var author = session.author;
//Tell the authorManager about the new attributes //Tell the authorManager about the new attributes
authorManager.setAuthorColorId(author, message.data.userInfo.colorId); authorManager.setAuthorColorId(author, message.data.userInfo.colorId);
authorManager.setAuthorName(author, message.data.userInfo.name); authorManager.setAuthorName(author, message.data.userInfo.name);
var padId = sessioninfos[client.id].padId; var padId = session.padId;
var infoMsg = { var infoMsg = {
type: "COLLABROOM", type: "COLLABROOM",