mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Handle case of messages length being less than unreadcount
this fixes #1561 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:
parent
2d9056d5af
commit
d272a2e4e6
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue