added null checks to theme.c, removed and added newline in language.c

This commit is contained in:
NightlyFox 2018-09-27 23:25:07 -05:00
parent 624fbed1fd
commit cd8698c4b0
2 changed files with 10 additions and 6 deletions

View File

@ -319,7 +319,6 @@ const char* const g_strings[StrId_Max][16] =
STR_TW("应用"), STR_TW("应用"),
}, },
[StrId_ThemeMenu] = [StrId_ThemeMenu] =
{ {
STR_EN("Theme Menu"), STR_EN("Theme Menu"),

View File

@ -176,12 +176,17 @@ void SetThemePathToConfig(const char* themePath) {
if(good_cfg) { if(good_cfg) {
group = config_lookup(&cfg, "hbmenuConfig"); group = config_lookup(&cfg, "hbmenuConfig");
if(group != NULL)
setting = config_setting_lookup(group, "themePath"); setting = config_setting_lookup(group, "themePath");
if(setting != NULL)
config_setting_set_string(setting, themePath); config_setting_set_string(setting, themePath);
} else { } else {
root = config_root_setting(&cfg); root = config_root_setting(&cfg);
if(root != NULL)
group = config_setting_add(root, "hbmenuConfig", CONFIG_TYPE_GROUP); group = config_setting_add(root, "hbmenuConfig", CONFIG_TYPE_GROUP);
if(group != NULL)
setting = config_setting_add(group, "themePath", CONFIG_TYPE_STRING); setting = config_setting_add(group, "themePath", CONFIG_TYPE_STRING);
if(setting != NULL)
config_setting_set_string(setting, themePath); config_setting_set_string(setting, themePath);
} }