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

Fix UI crash when domain metadata is missing (#10180)

The "Confirm public encryption key" page will now no longer crash when
the domain metadata is missing.
This commit is contained in:
Mark Stacey 2021-01-12 22:22:58 -03:30 committed by GitHub
parent 0dfdd44ae7
commit 9e03066157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,23 +158,24 @@ export default class ConfirmEncryptionPublicKey extends Component {
const { domainMetadata, txData } = this.props
const { t } = this.context
const origin = domainMetadata[txData.origin]
const notice = t('encryptionPublicKeyNotice', [origin.name])
const originMetadata = domainMetadata[txData.origin]
const notice = t('encryptionPublicKeyNotice', [txData.origin])
const name = originMetadata?.name || txData.origin
return (
<div className="request-encryption-public-key__body">
{this.renderAccountInfo()}
<div className="request-encryption-public-key__visual">
<section>
{origin.icon ? (
{originMetadata?.icon ? (
<img
className="request-encryption-public-key__visual-identicon"
src={origin.icon}
src={originMetadata.icon}
alt=""
/>
) : (
<i className="request-encryption-public-key__visual-identicon--default">
{origin.name.charAt(0).toUpperCase()}
{name.charAt(0).toUpperCase()}
</i>
)}
<div className="request-encryption-public-key__notice">