diff options
author | Explorer09 <explorer09@gmail.com> | 2023-08-26 15:55:02 +0800 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2023-08-29 21:47:56 +0200 |
commit | 8ecdb75d74c393895c68be7a311db959b1f373e9 (patch) | |
tree | a230f3722c090b22da65b2dfea850d2e2d42f74a /Meter.c | |
parent | a4debfe55045aacdff96807b697fa8771946a7ff (diff) |
Explicitly ignore NaN values in BarMeterMode_draw()
Do not throw FP exceptions if any value in a Meter object is a NaN.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'Meter.c')
-rw-r--r-- | Meter.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -225,8 +225,9 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { int offset = 0; for (uint8_t i = 0; i < this->curItems; i++) { double value = this->values[i]; - value = CLAMP(value, 0.0, this->total); - if (value > 0) { + if (isPositive(value)) { + assert(this->total > 0.0); + value = MINIMUM(value, this->total); blockSizes[i] = ceil((value / this->total) * w); } else { blockSizes[i] = 0; |