Handle case of messages length being less than unreadcount

this fixes  by making sure that if the count is retrieved before the messages themselves, there is no error in the console.
This commit is contained in:
Matthew Taylor 2017-10-02 10:33:53 -04:00
parent 2d9056d5af
commit d272a2e4e6

View file

@ -132,7 +132,9 @@ var Messages = React.createClass({
} else {
filteredMessages = messages;
for (var j = 0; j < unreadCount; j++) {
filteredMessages[j].unread = true;
if (typeof filteredMessages[j] !== 'undefined') {
filteredMessages[j].unread = true;
}
}
}
return filteredMessages;