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("应用"),
},
[StrId_ThemeMenu] =
{
STR_EN("Theme Menu"),

View File

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