Don't explode if the SdkConfig isn't available

This can happen prior to logging in, for some reason.

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-10-29 22:53:59 -06:00
parent 99ee58d13a
commit 72517f95bb
2 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,8 @@ import SdkConfig from "../SdkConfig";
*/ */
export default class ConfigSettingsHandler extends SettingsHandler { export default class ConfigSettingsHandler extends SettingsHandler {
getValue(settingName, roomId) { getValue(settingName, roomId) {
const settingsConfig = SdkConfig.get()["settingDefaults"]; const config = SdkConfig.get() || {};
const settingsConfig = config["settingDefaults"];
if (!settingsConfig || !settingsConfig[settingName]) return null; if (!settingsConfig || !settingsConfig[settingName]) return null;
return settingsConfig[settingName]; return settingsConfig[settingName];
} }