diff --git a/src/components/views/elements/DeviceVerifyButtons.js b/src/components/views/elements/DeviceVerifyButtons.js index b88fbdfc06..cfd79529f1 100644 --- a/src/components/views/elements/DeviceVerifyButtons.js +++ b/src/components/views/elements/DeviceVerifyButtons.js @@ -42,7 +42,9 @@ export default React.createClass({ componentWillUnmount: function() { const cli = MatrixClientPeg.get(); - cli.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged); + if (cli) { + cli.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged); + } }, onDeviceVerificationChanged: function(userId, deviceId, deviceInfo) {