From 7b28dde263e67f9e52926a7e7f38509e6814c78b Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 29 Sep 2016 16:57:10 +0100 Subject: [PATCH] Prevent error when clicking 'log in' If you joined a room before clicking 'log in', it would throw an exception here and break. --- src/components/views/rooms/MessageComposer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 4aeebe1411..e78cf0b13e 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -67,7 +67,9 @@ export default class MessageComposer extends React.Component { } componentWillUnmount() { - MatrixClientPeg.get().removeListener("event", this.onEvent); + if (MatrixClientPeg.get()) { + MatrixClientPeg.get().removeListener("event", this.onEvent); + } } onEvent(event) {