about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/config/color.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/config/color.c b/src/config/color.c
index b5df3d2f..8ece8498 100644
--- a/src/config/color.c
+++ b/src/config/color.c
@@ -371,11 +371,14 @@ void color_pair_cache_reset(void)
         cache.capacity = 8;
 
     cache.pairs = g_malloc0(sizeof(*cache.pairs)*cache.capacity);
-
-    /* default_default */
-    cache.pairs[0].fg = -1;
-    cache.pairs[0].bg = -1;
-    cache.size = 1;
+    if (cache.pairs) {
+        /* default_default */
+        cache.pairs[0].fg = -1;
+        cache.pairs[0].bg = -1;
+        cache.size = 1;
+    } else {
+        log_error("Color: unable to allocate memory");
+    }
 }
 
 /**