From a2a13636ed49e9eb1d97f63e26adc4d6dcd9570a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 13 Feb 2019 20:02:18 -0700 Subject: [PATCH] Don't blow up when rooms have no timelines --- src/stores/RoomListStore.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index d2e94ffd05..e38a592f7a 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -450,6 +450,10 @@ class RoomListStore extends Store { } _tsOfNewestEvent(room) { + // Apparently we can have rooms without timelines, at least under testing + // environments. Just return MAX_INT when this happens. + if (!room.timeline) return Number.MAX_SAFE_INTEGER; + for (let i = room.timeline.length - 1; i >= 0; --i) { const ev = room.timeline[i]; if (this._eventTriggersRecentReorder(ev)) {