Ensure blurhash is treated as optional

Fixes https://github.com/vector-im/element-web/issues/18702
This commit is contained in:
Travis Ralston 2021-08-23 16:48:39 -06:00
parent 32343f3382
commit 30c9860274
2 changed files with 3 additions and 3 deletions

View file

@ -393,7 +393,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
const classes = classNames({
'mx_MImageBody_thumbnail': true,
'mx_MImageBody_thumbnail--blurhash': this.props.mxEvent.getContent().info[BLURHASH_FIELD],
'mx_MImageBody_thumbnail--blurhash': this.props.mxEvent.getContent().info?.[BLURHASH_FIELD],
});
// This has incredibly broken types.
@ -446,7 +446,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
// Overidden by MStickerBody
protected getPlaceholder(width: number, height: number): JSX.Element {
const blurhash = this.props.mxEvent.getContent().info[BLURHASH_FIELD];
const blurhash = this.props.mxEvent.getContent().info?.[BLURHASH_FIELD];
if (blurhash) {
if (this.state.placeholder === 'no-image') {