Przeglądaj źródła

Fix exception that occurs when optional cp attribute is missing

Fix issue #3700
Dele Olajide 1 miesiąc temu
rodzic
commit
d336d85998
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      src/headless/plugins/emoji/utils.js

+ 1 - 1
src/headless/plugins/emoji/utils.js

@@ -108,7 +108,7 @@ export function getShortnameReferences (text) {
     }
     const references = [...text.matchAll(converse.emojis.shortnames_regex)].filter(ref => ref[0].length > 0);
     return references.map(ref => {
-        const cp = converse.emojis.by_sn[ref[0].toLowerCase()].cp;
+        const cp = converse.emojis.by_sn[ref[0].toLowerCase()]?.cp;
         return {
             cp,
             'begin': ref.index,