Skip to content

Commit

Permalink
move configError check earlier, as SdkConfig will cause Exception
Browse files Browse the repository at this point in the history
if it has undefined pass to it

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Jun 6, 2018
1 parent ab09d4b commit 026a072
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/vector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ async function loadApp() {

const configJson = await loadConfig();

if (!configJson) {
window.matrixChat = ReactDOM.render(<div className="error">
Unable to load config file: please refresh the page to try again.
</div>, 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);
Expand Down Expand Up @@ -343,11 +350,7 @@ async function loadApp() {
}

console.log("Vector starting at "+window.location);
if (!configJson) {
window.matrixChat = ReactDOM.render(<div className="error">
Unable to load config file: please refresh the page to try again.
</div>, document.getElementById('matrixchat'));
} else if (validBrowser) {
if (validBrowser) {
const platform = PlatformPeg.get();
platform.startUpdater();

Expand Down

0 comments on commit 026a072

Please sign in to comment.