From 84ecaa2ee1e42a60b0acef4f978ffcfe442eefc9 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 2 Jun 2021 18:41:52 +0200 Subject: [PATCH] don't trip over missing create events when loading power levels as the test from previous commit fails because of that, and powerlevels works fine without --- src/matrix/room/timeline/Timeline.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index dfb75aca..af7ab405 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -84,10 +84,14 @@ export class Timeline { }); } const createState = await txn.roomState.get(this._roomId, "m.room.create", ""); - return new PowerLevels({ - createEvent: createState.event, - ownUserId: this._ownMember.userId - }); + if (createState) { + return new PowerLevels({ + createEvent: createState.event, + ownUserId: this._ownMember.userId + }); + } else { + return new PowerLevels({ownUserId: this._ownMember.userId}); + } } _setupEntries(timelineEntries) {