1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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.
This commit is contained in:
Mark Stacey 2021-01-22 15:10:43 -03:30 committed by GitHub
parent 1dad4abfdc
commit ab3b64e643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()}
<div className="request-decrypt-message__visual">
<section>
{origin.icon ? (
{originMetadata?.icon ? (
<img
className="request-decrypt-message__visual-identicon"
src={origin.icon}
src={originMetadata?.icon}
alt=""
/>
) : (
<i className="request-decrypt-message__visual-identicon--default">
{origin.name.charAt(0).toUpperCase()}
{name.charAt(0).toUpperCase()}
</i>
)}
<div className="request-decrypt-message__notice">{notice}</div>