about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-15 00:32:59 +0100
committerGitHub <noreply@github.com>2022-11-15 00:32:59 +0100
commitceafd1f68f1f1b57c998adf693678059f9aaa70c (patch)
treea5616bb6d7a798f8c8e572db3a6c36dfb48b1bac /app/javascript/flavours
parente589afa0ef520747919935956d2d87746000adc9 (diff)
Fix infinite loop when system emoji font is enabled (#1931)
Fixes #1930
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/features/emoji/emoji.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/emoji/emoji.js b/app/javascript/flavours/glitch/features/emoji/emoji.js
index 880f9401d..50a399114 100644
--- a/app/javascript/flavours/glitch/features/emoji/emoji.js
+++ b/app/javascript/flavours/glitch/features/emoji/emoji.js
@@ -30,11 +30,11 @@ const emojifyTextNode = (node, customEmojis) => {
     let match, i = 0;
 
     if (customEmojis === null) {
-      while (i < str.length && !(match = trie.search(str.slice(i)))) {
+      while (i < str.length && (useSystemEmojiFont || !(match = trie.search(str.slice(i))))) {
         i += str.codePointAt(i) < 65536 ? 1 : 2;
       }
     } else {
-      while (i < str.length && str[i] !== ':' && !(match = trie.search(str.slice(i)))) {
+      while (i < str.length && str[i] !== ':' && (useSystemEmojiFont || !(match = trie.search(str.slice(i))))) {
         i += str.codePointAt(i) < 65536 ? 1 : 2;
       }
     }