From 72517f95bb518400bceb0c58234ccd155fcd048e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sun, 29 Oct 2017 22:53:59 -0600 Subject: [PATCH] Don't explode if the SdkConfig isn't available This can happen prior to logging in, for some reason. Signed-off-by: Travis Ralston --- src/components/views/elements/SettingsCheckbox.js | 2 +- src/settings/ConfigSettingsHandler.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/SettingsCheckbox.js b/src/components/views/elements/SettingsCheckbox.js index a195bae691..d9b293b086 100644 --- a/src/components/views/elements/SettingsCheckbox.js +++ b/src/components/views/elements/SettingsCheckbox.js @@ -64,7 +64,7 @@ module.exports = React.createClass({ value={this.props.value} checked={val === this.props.value} onChange={this.onChange} - /> + /> ); } diff --git a/src/settings/ConfigSettingsHandler.js b/src/settings/ConfigSettingsHandler.js index 5cd6d22411..b9f392f048 100644 --- a/src/settings/ConfigSettingsHandler.js +++ b/src/settings/ConfigSettingsHandler.js @@ -24,7 +24,8 @@ import SdkConfig from "../SdkConfig"; */ export default class ConfigSettingsHandler extends SettingsHandler { getValue(settingName, roomId) { - const settingsConfig = SdkConfig.get()["settingDefaults"]; + const config = SdkConfig.get() || {}; + const settingsConfig = config["settingDefaults"]; if (!settingsConfig || !settingsConfig[settingName]) return null; return settingsConfig[settingName]; }