diff --git a/src/matrix/room/BaseRoom.js b/src/matrix/room/BaseRoom.js index f3d2a707..531f6a1a 100644 --- a/src/matrix/room/BaseRoom.js +++ b/src/matrix/room/BaseRoom.js @@ -404,10 +404,16 @@ export class BaseRoom extends EventEmitter { clock: this._platform.clock, logger: this._platform.logger, }); - if (this._roomEncryption) { - this._timeline.enableEncryption(this._decryptEntries.bind(this, DecryptionSource.Timeline)); + try { + if (this._roomEncryption) { + this._timeline.enableEncryption(this._decryptEntries.bind(this, DecryptionSource.Timeline)); + } + await this._timeline.load(this._user, this.membership, log); + } catch (err) { + // this also clears this._timeline in the closeCallback + this._timeline.dispose(); + throw err; } - await this._timeline.load(this._user, this.membership, log); return this._timeline; }); }