Skip to content

Commit

Permalink
don't leak timeline when an error is thrown while opening it
Browse files Browse the repository at this point in the history
or you are just stuck with "not dealing with race" errors until refresh
  • Loading branch information
bwindels committed Jun 2, 2021
1 parent 0c4c018 commit d965d57
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/matrix/room/BaseRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
Expand Down

0 comments on commit d965d57

Please sign in to comment.