diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-08-23 14:54:55 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2019-08-23 14:54:55 +0200 |
commit | e408e988a76de24a9872a2a8047594eb2270f017 (patch) | |
tree | c62d64bbfe26e600d8cae1794fdead5d104c70e2 | |
parent | bad244fc9508644beb655816e7f7b58ec7bd6a6d (diff) | |
download | profani-tty-e408e988a76de24a9872a2a8047594eb2270f017.tar.gz |
color: set capacity in unittest case
Fix https://github.com/profanity-im/profanity/issues/1178
-rw-r--r-- | src/config/color.c | 5 |
1 files changed, 5 insertions, 0 deletions
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 */ |