From 6cd08a266afe2020d8837f4392ee9ef7686bb469 Mon Sep 17 00:00:00 2001 From: Steven Tappert Date: Mon, 5 Nov 2018 18:51:43 +0100 Subject: [PATCH] Check for empty "last_status" before sorting DM column (#9207) * Check for empty "last_status" before sorting * Small touchups for codeclimate --- app/javascript/mastodon/reducers/conversations.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js index b13a9fdf4f..955a07754d 100644 --- a/app/javascript/mastodon/reducers/conversations.js +++ b/app/javascript/mastodon/reducers/conversations.js @@ -56,7 +56,13 @@ const expandNormalizedConversations = (state, conversations, next) => { list = list.concat(items); - return list.sortBy(x => x.get('last_status'), (a, b) => compareId(a, b) * -1); + return list.sortBy(x => x.get('last_status'), (a, b) => { + if(a === null || b === null) { + return -1; + } + + return compareId(a, b) * -1; + }); }); }