From 69d1844773aa1247a7c0ea39c2fbeafa0bf1e839 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 14 Jul 2015 12:10:15 +0100 Subject: [PATCH] fix NPE for invites --- src/RoomListSorter.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/RoomListSorter.js b/src/RoomListSorter.js index bc7a001670..730a0de18b 100644 --- a/src/RoomListSorter.js +++ b/src/RoomListSorter.js @@ -17,7 +17,12 @@ limitations under the License. 'use strict'; function tsOfNewestEvent(room) { - return room.timeline[room.timeline.length - 1].getTs(); + if (room.timeline.length) { + return room.timeline[room.timeline.length - 1].getTs(); + } + else { + return Number.MAX_SAFE_INTEGER; + } } function mostRecentActivityFirst(roomList) {