Don't blow up when rooms have no timelines

pull/21833/head
Travis Ralston 2019-02-13 20:02:18 -07:00
parent b12362dd37
commit a2a13636ed
1 changed files with 4 additions and 0 deletions

View File

@ -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)) {