From 7f0621e84da1965076a8ad14fe76777abc8b5ce9 Mon Sep 17 00:00:00 2001
From: "mikhail.aheichyk" <mikhail.aheichyk@nordeck.net>
Date: Tue, 20 Dec 2022 12:52:31 +0300
Subject: [PATCH] ts error fix

---
 src/stores/widgets/StopGapWidget.ts | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts
index 9efa14829c..dfacefa1cd 100644
--- a/src/stores/widgets/StopGapWidget.ts
+++ b/src/stores/widgets/StopGapWidget.ts
@@ -523,9 +523,11 @@ export class StopGapWidget extends EventEmitter {
         // Skip marker assignment if membership is 'invite', otherwise 'm.room.member' from
         // invitation room will assign it and new state events will be not forwarded to the widget
         // because of empty timeline for invitation room and assigned marker.
-        const room = this.client.getRoom(ev.getRoomId());
-        if (room && room.getMyMembership() !== "invite") {
-            this.readUpToMap[ev.getRoomId()] = ev.getId();
+        if (ev.getRoomId()) {
+            const room = this.client.getRoom(ev.getRoomId());
+            if (room && room.getMyMembership() !== "invite") {
+                this.readUpToMap[ev.getRoomId()] = ev.getId();
+            }
         }
 
         const raw = ev.getEffectiveEvent();