From 6d5683dd3f4b1059e8b9f8b8f0a2796b7659ce8d Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 22 Jan 2021 15:10:43 -0330 Subject: [PATCH] Fix decrypt message confirmation UI crash (#10252) The decrupt message confirmation UI will crash if the origin metadata is not present. This PR makes the UI tolerant of that metadata being missing. It was always intended to be optional anyway. --- .../confirm-decrypt-message.component.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js b/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js index a9f68d388..d9baf455e 100644 --- a/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js +++ b/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js @@ -174,8 +174,9 @@ export default class ConfirmDecryptMessage extends Component { const { decryptMessageInline, domainMetadata, txData } = this.props const { t } = this.context - const origin = domainMetadata[txData.msgParams.origin] - const notice = t('decryptMessageNotice', [origin.name]) + const originMetadata = domainMetadata[txData.msgParams.origin] + const name = originMetadata?.name || txData.msgParams.origin + const notice = t('decryptMessageNotice', [txData.msgParams.origin]) const { hasCopied, @@ -191,15 +192,15 @@ export default class ConfirmDecryptMessage extends Component { {this.renderAccountInfo()}
- {origin.icon ? ( + {originMetadata?.icon ? ( ) : ( - {origin.name.charAt(0).toUpperCase()} + {name.charAt(0).toUpperCase()} )}
{notice}