summaryrefslogtreecommitdiffstats
path: root/Meter.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2022-03-07 13:52:07 +0800
committerBenBE <BenBE@geshi.org>2023-11-12 11:57:47 +0100
commitef487e9409431c53aac524a7392efdb085964355 (patch)
treee72dc70fd1c2065eef86468c0154225d8f681ca4 /Meter.c
parent5e8fc97a96dd2dea1aad8c6c4f2e872aede38ead (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.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Meter.c b/Meter.c
index 07b88c0a..118eef91 100644
--- a/Meter.c
+++ b/Meter.c
@@ -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, '|');

© 2014-2024 Faster IT GmbH | imprint | privacy policy