Ver código fonte

Bugfix. Don't assume OMEMO store is always there

JC Brand 5 anos atrás
pai
commit
5cb65d84f1
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      src/headless/utils/stanza.js

+ 2 - 1
src/headless/utils/stanza.js

@@ -79,7 +79,8 @@ function getEncryptionAttributes (stanza, original_stanza, attrs, chatbox, _conv
     if (!encrypted || !_converse.config.get('trusted')) {
         return attrs;
     }
-    const key = sizzle(`key[rid="${_converse.omemo_store.get('device_id')}"]`, encrypted).pop();
+    const device_id = _converse.omemo_store?.get('device_id');
+    const key = device_id && sizzle(`key[rid="${device_id}"]`, encrypted).pop();
     if (key) {
         const header = encrypted.querySelector('header');
         attrs['is_encrypted'] = true;