diff options
author | Explorer09 <explorer09@gmail.com> | 2022-03-07 13:52:07 +0800 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2023-11-12 11:57:47 +0100 |
commit | ef487e9409431c53aac524a7392efdb085964355 (patch) | |
tree | e72dc70fd1c2065eef86468c0154225d8f681ca4 /Meter.c | |
parent | 5e8fc97a96dd2dea1aad8c6c4f2e872aede38ead (diff) |
Assert on BarMeterMode_characters length
The number of items of a Meter can exceed the length of
BarMeterMode_characters array. (The CPU Meter is an example.)
Item numbers exceeding the length are unplottable in a bar.
Add an assertion to note the fact.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'Meter.c')
-rw-r--r-- | Meter.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -238,6 +238,7 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { for (int j = offset; j < nextOffset; j++) if (RichString_getCharVal(bar, startPos + j) == ' ') { if (CRT_colorScheme == COLORSCHEME_MONOCHROME) { + assert(i < strlen(BarMeterMode_characters)); RichString_setChar(&bar, startPos + j, BarMeterMode_characters[i]); } else { RichString_setChar(&bar, startPos + j, '|'); |