about summary refs log tree commit diff stats
path: root/src/config/theme.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/theme.c')
-rw-r--r--src/config/theme.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/config/theme.c b/src/config/theme.c
index 9becc833..38eb3f2e 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -184,6 +184,9 @@ theme_exists(const char* const theme_name)
 gboolean
 theme_load(const char* const theme_name, gboolean load_theme_prefs)
 {
+    if (!theme_exists(theme_name))
+        return FALSE;
+
     color_pair_cache_reset();
 
     if (_theme_load_file(theme_name)) {
@@ -663,20 +666,21 @@ theme_get_bkgnd(void)
 static void
 _theme_prep_fgnd(char* setting, GString* lookup_str, gboolean* bold)
 {
-    gchar* val = g_key_file_get_string(theme, "colours", setting, NULL);
-    if (!val) {
-        char* def = g_hash_table_lookup(defaults, setting);
-        g_string_append(lookup_str, def);
+    gchar* conf_str = g_key_file_get_string(theme, "colours", setting, NULL);
+    gchar* val = conf_str;
+
+    if (!val)
+        val = g_hash_table_lookup(defaults, setting);
+
+    if (g_str_has_prefix(val, "bold_")) {
+        g_string_append(lookup_str, &val[5]);
+        *bold = TRUE;
     } else {
-        if (g_str_has_prefix(val, "bold_")) {
-            g_string_append(lookup_str, &val[5]);
-            *bold = TRUE;
-        } else {
-            g_string_append(lookup_str, val);
-            *bold = FALSE;
-        }
+        g_string_append(lookup_str, val);
+        *bold = FALSE;
     }
-    g_free(val);
+
+    g_free(conf_str);
 }
 
 char*