Skip to content

Commit

Permalink
findTopCellItem() handle underflow (f11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Feb 7, 2024
1 parent d1d207f commit 1409533
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,19 +432,15 @@ static uint8_t GraphMeterMode_findTopCellItem(const Meter* this, double scaledTo
maxValue = value;
}
topCellItem = i;
} else {
if (hasPrevArea) {
if (area >= maxValue) {
hasPrevArea = false;
maxValue = value;
topCellItem = i;
}
} else {
if (value >= maxValue) {
maxValue = value;
topCellItem = i;
}
} else if (hasPrevArea) {
if (area >= maxValue) {
hasPrevArea = false;
maxValue = value;
topCellItem = i;
}
} else if (value >= maxValue) {
maxValue = value;
topCellItem = i;
}
}
return topCellItem;
Expand Down

0 comments on commit 1409533

Please sign in to comment.