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 = {};