From 75bff228ec6964d4300ef0679809f06903a81f34 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 14 Sep 2020 17:45:13 +0200 Subject: [PATCH] fix data not being passed on, caused crash on initial sync --- src/matrix/room/Room.js | 2 +- src/matrix/room/RoomSummary.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 69037c88..5976242d 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -181,7 +181,7 @@ export class Room extends EventEmitter { // fetch new members while we have txn open, // but don't make any in-memory changes yet let heroChanges; - if (needsHeroes(summaryChanges)) { + if (summaryChanges && needsHeroes(summaryChanges)) { // room name disappeared, open heroes if (!this._heroes) { this._heroes = new Heroes(this._roomId); diff --git a/src/matrix/room/RoomSummary.js b/src/matrix/room/RoomSummary.js index b5220468..741b8764 100644 --- a/src/matrix/room/RoomSummary.js +++ b/src/matrix/room/RoomSummary.js @@ -52,6 +52,7 @@ function applySyncResponse(data, roomResponse, membership) { if (typeof event.state_key === "string") { return processStateEvent(data, event); } + return data; }, data); } const unreadNotifications = roomResponse.unread_notifications; @@ -307,9 +308,9 @@ export class RoomSummary { // clear cloned flag, so cloneIfNeeded makes a copy and // this._data is not modified if any field is changed. this._data.cloned = false; - let data = applySyncResponse(this._data, roomResponse, membership); + let data = applySyncResponse(this._data, roomResponse, membership); data = applyTimelineEntries( - this._data, + data, timelineEntries, isInitialSync, isTimelineOpen, this._ownUserId);