From e751333bbdf2978af811b1c4876eb05b95d277fd Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 28 Aug 2020 13:58:42 +0200 Subject: [PATCH] don't assume setting up a session went all the way through when stopping --- src/matrix/SessionContainer.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index ae9572a9..1b6e21d8 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -237,10 +237,16 @@ export class SessionContainer { } stop() { - this._reconnectSubscription(); - this._reconnectSubscription = null; - this._sync.stop(); - this._session.stop(); + if (this._reconnectSubscription) { + this._reconnectSubscription(); + this._reconnectSubscription = null; + } + if (this._sync) { + this._sync.stop(); + } + if (this._session) { + this._session.stop(); + } if (this._waitForFirstSyncHandle) { this._waitForFirstSyncHandle.dispose(); this._waitForFirstSyncHandle = null;