1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

color: set capacity in unittest case

Fix https://github.com/profanity-im/profanity/issues/1178
This commit is contained in:
Michael Vetter 2019-08-23 14:54:55 +02:00
parent bad244fc95
commit e408e988a7

View File

@ -365,6 +365,11 @@ void color_pair_cache_reset(void)
* compile-time constant * compile-time constant
*/ */
cache.capacity = COLOR_PAIRS; 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); cache.pairs = g_malloc0(sizeof(*cache.pairs)*cache.capacity);
/* default_default */ /* default_default */