Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 30c9860

Browse files
committed
Ensure blurhash is treated as optional
Fixes element-hq/element-web#18702
1 parent 32343f3 commit 30c9860

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/views/messages/MImageBody.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
393393

394394
const classes = classNames({
395395
'mx_MImageBody_thumbnail': true,
396-
'mx_MImageBody_thumbnail--blurhash': this.props.mxEvent.getContent().info[BLURHASH_FIELD],
396+
'mx_MImageBody_thumbnail--blurhash': this.props.mxEvent.getContent().info?.[BLURHASH_FIELD],
397397
});
398398

399399
// This has incredibly broken types.
@@ -446,7 +446,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
446446

447447
// Overidden by MStickerBody
448448
protected getPlaceholder(width: number, height: number): JSX.Element {
449-
const blurhash = this.props.mxEvent.getContent().info[BLURHASH_FIELD];
449+
const blurhash = this.props.mxEvent.getContent().info?.[BLURHASH_FIELD];
450450

451451
if (blurhash) {
452452
if (this.state.placeholder === 'no-image') {

src/components/views/messages/MStickerBody.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class MStickerBody extends MImageBody {
4343
// Placeholder to show in place of the sticker image if
4444
// img onLoad hasn't fired yet.
4545
protected getPlaceholder(width: number, height: number): JSX.Element {
46-
if (this.props.mxEvent.getContent().info[BLURHASH_FIELD]) return super.getPlaceholder(width, height);
46+
if (this.props.mxEvent.getContent().info?.[BLURHASH_FIELD]) return super.getPlaceholder(width, height);
4747
return <img src={require("../../../../res/img/icons-show-stickers.svg")} width="75" height="75" />;
4848
}
4949

0 commit comments

Comments
 (0)