From 06133b04672059486270d6ce20c5960906c88ff7 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 15 Feb 2016 23:04:21 +0000 Subject: [PATCH] Add a null guard for matrix client TimelinePanel.componentWillUnmount client can be null when unmounting --- src/components/structures/TimelinePanel.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 7f170d3695..4b050bfed8 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -117,8 +117,12 @@ module.exports = React.createClass({ this.unmounted = true; dis.unregister(this.dispatcherRef); - MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); - MatrixClientPeg.get().removeListener("Room.receipt", this.onRoomReceipt); + + var client = MatrixClientPeg.get(); + if (client) { + client.removeListener("Room.timeline", this.onRoomTimeline); + client.removeListener("Room.receipt", this.onRoomReceipt); + } }, // set off a pagination request.