From cdd73e6e1f318fefe82fd0fd8bf3d0180f1dbf64 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 24 Jul 2018 16:55:45 +0100 Subject: [PATCH] Check matrix client exists when stopping --- src/stores/ActiveWidgetStore.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/ActiveWidgetStore.js b/src/stores/ActiveWidgetStore.js index 53c17d0ee6..cc27febaf9 100644 --- a/src/stores/ActiveWidgetStore.js +++ b/src/stores/ActiveWidgetStore.js @@ -52,7 +52,9 @@ class ActiveWidgetStore extends EventEmitter { } stop() { - MatrixClientPeg.get().removeListener('RoomState.events', this.onRoomStateEvents); + if (MatrixClientPeg.get()) { + MatrixClientPeg.get().removeListener('RoomState.events', this.onRoomStateEvents); + } this._capsByWidgetId = {}; this._widgetMessagingByWidgetId = {}; this._roomIdByWidgetId = {};