Procházet zdrojové kódy

fix(e2ee) handle Olm initialization error

If the WASM code could not be loaded, fail to initialize if and remove it from
globals so the E2EE option becomes unavailable, since it will be non-functional.
master
Saúl Ibarra Corretgé před 5 roky
rodič
revize
3d7ea52416
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4
    1
      app.js

+ 4
- 1
app.js Zobrazit soubor

@@ -20,7 +20,10 @@ import translation from './modules/translation/translation';
20 20
 
21 21
 // Initialize Olm as early as possible.
22 22
 if (window.Olm) {
23
-    window.Olm.init();
23
+    window.Olm.init().catch(e => {
24
+        console.error('Failed to initialize Olm, E2EE will be disabled', e);
25
+        delete window.Olm;
26
+    });
24 27
 }
25 28
 
26 29
 window.APP = {

Načítá se…
Zrušit
Uložit