Fix crash when message attachment does not have images (#2377)
* Fix crash when message attachment does not have images * optional chaining
This commit is contained in:
parent
a03016a9e3
commit
4925970b86
1 changed files with 2 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ export default class AttachmentImage extends PureComponent {
|
|||
const {imageUrl, metadata} = this.props;
|
||||
|
||||
this.setViewPortMaxWidth();
|
||||
if (metadata?.images[imageUrl]) {
|
||||
if (metadata?.images?.[imageUrl]) {
|
||||
const img = metadata.images[imageUrl];
|
||||
this.setImageDimensionsFromMeta(null, img);
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ export default class AttachmentImage extends PureComponent {
|
|||
setImageUrl = (imageURL) => {
|
||||
const {imageUrl: attachmentImageUrl, metadata} = this.props;
|
||||
|
||||
if (metadata?.images[attachmentImageUrl]) {
|
||||
if (metadata?.images?.[attachmentImageUrl]) {
|
||||
this.setImageDimensionsFromMeta(imageURL, metadata.images[attachmentImageUrl]);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue