From de9b964490857ce747d08d87599be1ddc2a1c2cb Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 25 Jan 2019 17:49:02 +0000 Subject: [PATCH] Fix NPE in RoomRecoveryReminder Also fix a bug introduced in https://github.com/matrix-org/matrix-react-sdk/pull/2506 where I failed to set the button caption in one case. Fixes https://github.com/vector-im/riot-web/issues/8216 --- src/components/views/rooms/RoomRecoveryReminder.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/RoomRecoveryReminder.js b/src/components/views/rooms/RoomRecoveryReminder.js index 32bf8ad5d1..e8c315ecf5 100644 --- a/src/components/views/rooms/RoomRecoveryReminder.js +++ b/src/components/views/rooms/RoomRecoveryReminder.js @@ -62,7 +62,7 @@ export default class RoomRecoveryReminder extends React.PureComponent { let unverifiedDevice; for (const sig of backupSigStatus.sigs) { - if (!sig.device.isVerified()) { + if (sig.device && !sig.device.isVerified()) { unverifiedDevice = sig.device; break; } @@ -133,12 +133,11 @@ export default class RoomRecoveryReminder extends React.PureComponent { const AccessibleButton = sdk.getComponent("views.elements.AccessibleButton"); let body; - let primaryCaption; + let primaryCaption = _t("Set up"); if (this.state.error) { body =
{_t("Unable to load key backup status")}
; - primaryCaption = _t("Set up"); } else if (this.state.unverifiedDevice) { // A key backup exists for this account, but the creating device is not // verified.