Prevent error when clicking 'log in'

If you joined a room before clicking 'log in', it would throw an
exception here and break.
This commit is contained in:
David Baker 2016-09-29 16:57:10 +01:00
parent 66ef1e8156
commit 7b28dde263

View file

@ -67,8 +67,10 @@ export default class MessageComposer extends React.Component {
} }
componentWillUnmount() { componentWillUnmount() {
if (MatrixClientPeg.get()) {
MatrixClientPeg.get().removeListener("event", this.onEvent); MatrixClientPeg.get().removeListener("event", this.onEvent);
} }
}
onEvent(event) { onEvent(event) {
if (event.getType() !== 'm.room.encryption') return; if (event.getType() !== 'm.room.encryption') return;