Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:zap: Adds safeguards to prevent error when conf.yml is empty

Alicia Sykes424cef1f811e
diff --git a/src/utils/ConfigAccumalator.js b/src/utils/ConfigAccumalator.js
index b1426eef..b92ee569 100644
--- a/src/utils/ConfigAccumalator.js
+++ b/src/utils/ConfigAccumalator.js
@@ -23,7 +23,10 @@ export default class ConfigAccumulator {
/* App Config */
appConfig() {
- const appConfigFile = this.conf.appConfig || {};
+ let appConfigFile = {};
+ if (this.conf) {
+ appConfigFile = this.conf.appConfig || {};
+ }
let usersAppConfig = defaultAppConfig;
if (localStorage[localStorageKeys.APP_CONFIG]) {
usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);
@@ -48,8 +51,11 @@ export default class ConfigAccumulator {
} catch (e) {
localPageInfo = {};
}
- const filePageInfo = this.conf.pageInfo || {};
- const pi = this.conf.pageInfo || defaults; // The page info object to return
+ let filePageInfo = {};
+ if (this.conf) {
+ filePageInfo = this.conf.pageInfo || {};
+ }
+ const pi = filePageInfo || defaults; // The page info object to return
pi.title = localPageInfo.title || filePageInfo.title || defaults.title;
pi.logo = localPageInfo.logo || filePageInfo.logo || defaults.logo;
pi.description = localPageInfo.description || filePageInfo.description || defaults.description;
@@ -71,7 +77,9 @@ export default class ConfigAccumulator {
}
}
// If the function hasn't yet returned, then return the config file sections
- return this.conf.sections;
+ let sectionsFile = [];
+ if (this.conf) sectionsFile = this.conf.sections || [];
+ return sectionsFile;
}
/* Complete config */