From ca8689fc8829ed118298043011ba6e3fe72d90d4 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Mon, 20 Jun 2022 14:55:38 +0100 Subject: [PATCH] bugfix: don't error if emoji not found --- src/components/mfm_content/mfm_content.jsx | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/mfm_content/mfm_content.jsx b/src/components/mfm_content/mfm_content.jsx index 9b1fca16..0ee6bd96 100644 --- a/src/components/mfm_content/mfm_content.jsx +++ b/src/components/mfm_content/mfm_content.jsx @@ -234,16 +234,21 @@ export default defineComponent({ } case 'emojiCode': { - return [h('div', { - class: 'still-image emoji img' - }, - [h('img', { - key: Math.random(), - title: token.props.name, - alt: token.props.name, - src: this.status.emojis.find((emoji) => emoji.shortcode === token.props.name).static_url - })] - )] + const emoj = this.status.emojis.find((emoji) => emoji.shortcode === token.props.name) + if (emoj) { + return [h('div', { + class: 'still-image emoji img' + }, + [h('img', { + key: Math.random(), + title: token.props.name, + alt: token.props.name, + src: this.status.emojis.find((emoji) => emoji.shortcode === token.props.name).static_url + })] + )] + } else { + return `:${token.props.name}:` + } } case 'unicodeEmoji': {