1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Make sure memory in color_pair_cache_reset() was allocated.

Just to be on the safe side.

Probably only relevant for unit tests where ncurses vars are not
initialized with real values.
Fix unit tests on all platforms.
This commit is contained in:
Michael Vetter 2019-08-24 18:04:02 +02:00
parent 77392e4dc6
commit 726eee2a66

View File

@ -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");
}
}
/**