From bb6905bdcdb991687c91b867f0562f6990e3e1c0 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 4 Jun 2021 16:05:28 +0200 Subject: [PATCH] don't assume localEntries exists, as load races with sync.afterSync --- src/matrix/room/timeline/Timeline.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index eab71255..aa331058 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -159,7 +159,9 @@ export class Timeline { // Once the subscription is setup, MappedList will set up the local // relations as needed with _applyAndEmitLocalRelationChange, // so we're not missing anything by bailing out. - if (!this._localEntries.hasSubscriptions) { + // + // _localEntries can also not yet exist + if (!this._localEntries?.hasSubscriptions) { return; } // find any local relations to this new remote event @@ -301,4 +303,4 @@ export function tests() { assert.equal(Array.from(timeline.entries)[0].isRedacting, true); } } -} \ No newline at end of file +}