From 640a3fb9fa2dc9097323fb44aeaaf43c1ace94e5 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 13 Dec 2021 15:13:45 +0530 Subject: [PATCH] Check if contextEvent was found --- src/matrix/room/timeline/Timeline.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 2f970975..9c689c5a 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -297,9 +297,11 @@ export class Timeline { let contextEvent = this._getTrackedEvent(id); if (!contextEvent) { contextEvent = await this._getEventFromStorage(id) ?? await this._getEventFromHomeserver(id); - // this entry was created from storage/hs, so it's not tracked by remoteEntries - // we track them here so that we can update reply previews later - this._contextEntriesNotInTimeline.set(id, contextEvent); + if (contextEvent) { + // this entry was created from storage/hs, so it's not tracked by remoteEntries + // we track them here so that we can update reply previews later + this._contextEntriesNotInTimeline.set(id, contextEvent); + } } if (contextEvent) { contextEvent.setAsContextOf(entry);