Fix infinite loop when system emoji font is enabled (#1931)

Fixes #1930
This commit is contained in:
Claire 2022-11-15 00:32:59 +01:00 committed by GitHub
parent e589afa0ef
commit ceafd1f68f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -30,11 +30,11 @@ const emojifyTextNode = (node, customEmojis) => {
let match, i = 0; let match, i = 0;
if (customEmojis === null) { 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; i += str.codePointAt(i) < 65536 ? 1 : 2;
} }
} else { } 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; i += str.codePointAt(i) < 65536 ? 1 : 2;
} }
} }