From 026a0722786ebd04a5e695c9899f694151d146b8 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 6 Jun 2018 13:09:31 +0100
Subject: [PATCH] move configError check earlier, as SdkConfig will cause
Exception if it has undefined pass to it
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/vector/index.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/vector/index.js b/src/vector/index.js
index 453d9b5750a..9ca44b21967 100644
--- a/src/vector/index.js
+++ b/src/vector/index.js
@@ -264,6 +264,13 @@ async function loadApp() {
const configJson = await loadConfig();
+ if (!configJson) {
+ window.matrixChat = ReactDOM.render(
+ Unable to load config file: please refresh the page to try again.
+
, document.getElementById('matrixchat'));
+ return;
+ }
+
// XXX: We call this twice, once here and once in MatrixChat as a prop. We call it here to ensure
// granular settings are loaded correctly and to avoid duplicating the override logic for the theme.
SdkConfig.put(configJson);
@@ -343,11 +350,7 @@ async function loadApp() {
}
console.log("Vector starting at "+window.location);
- if (!configJson) {
- window.matrixChat = ReactDOM.render(
- Unable to load config file: please refresh the page to try again.
-
, document.getElementById('matrixchat'));
- } else if (validBrowser) {
+ if (validBrowser) {
const platform = PlatformPeg.get();
platform.startUpdater();