From d272a2e4e6fad500066bed519696da494b5724e1 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Mon, 2 Oct 2017 10:33:53 -0400 Subject: [PATCH] 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. --- src/views/messages/container.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/messages/container.jsx b/src/views/messages/container.jsx index f6a32383c..0fd9a1b96 100644 --- a/src/views/messages/container.jsx +++ b/src/views/messages/container.jsx @@ -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;