From a73fe72b0961d605584ef5e6eb556f3dbae94d53 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 13 Jan 2021 12:25:36 +0000 Subject: [PATCH] Fix soft crash on soft logout page This fixes a soft crash on the soft logout page, which can occur if it is shown very quickly after app startup before encryption has become enabled. --- src/components/structures/auth/SoftLogout.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/structures/auth/SoftLogout.js b/src/components/structures/auth/SoftLogout.js index fdc1aec96de..a7fe3404577 100644 --- a/src/components/structures/auth/SoftLogout.js +++ b/src/components/structures/auth/SoftLogout.js @@ -72,9 +72,12 @@ export default class SoftLogout extends React.Component { this._initLogin(); - MatrixClientPeg.get().countSessionsNeedingBackup().then(remaining => { - this.setState({keyBackupNeeded: remaining > 0}); - }); + const cli = MatrixClientPeg.get(); + if (cli.isCryptoEnabled()) { + cli.countSessionsNeedingBackup().then(remaining => { + this.setState({ keyBackupNeeded: remaining > 0 }); + }); + } } onClearAll = () => {