Merge pull request #4186 from matrix-org/jryans/mjolnir-stop

Make Mjolnir stop more robust
pull/21833/head
J. Ryan Stinnett 2020-03-09 16:15:32 +00:00 committed by GitHub
commit d2cd64d9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -65,14 +65,14 @@ export class Mjolnir {
} }
stop() { stop() {
SettingsStore.unwatchSetting(this._mjolnirWatchRef); if (this._mjolnirWatchRef) {
SettingsStore.unwatchSetting(this._mjolnirWatchRef);
this._mjolnirWatchRef = null;
}
try { if (this._dispatcherRef) {
if (this._dispatcherRef) dis.unregister(this._dispatcherRef); dis.unregister(this._dispatcherRef);
} catch (e) { this._dispatcherRef = null;
console.error(e);
// Only the tests cause problems with this particular block of code. We should
// never be here in production.
} }
if (!MatrixClientPeg.get()) return; if (!MatrixClientPeg.get()) return;