From e408e988a76de24a9872a2a8047594eb2270f017 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Fri, 23 Aug 2019 14:54:55 +0200 Subject: color: set capacity in unittest case Fix https://github.com/profanity-im/profanity/issues/1178 --- src/config/color.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config/color.c b/src/config/color.c index d80b2b36..b5df3d2f 100644 --- a/src/config/color.c +++ b/src/config/color.c @@ -365,6 +365,11 @@ void color_pair_cache_reset(void) * compile-time constant */ cache.capacity = COLOR_PAIRS; + + /* when we run unit tests COLOR_PAIRS will be -1 */ + if (cache.capacity < 0) + cache.capacity = 8; + cache.pairs = g_malloc0(sizeof(*cache.pairs)*cache.capacity); /* default_default */ -- cgit 1.4.1-2-gfad0