mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-21 06:59:02 +00:00
fix warning and ub (#3089)
This commit is contained in:
@@ -294,8 +294,8 @@ bool BtnGridView::set_highlighted(int32_t new_value, bool force_update) {
|
||||
}
|
||||
|
||||
// Normalize offset to show maximum items when count decreased
|
||||
if (offset + displayed_max > item_count && item_count > 0) {
|
||||
if (item_count >= displayed_max) {
|
||||
if (item_count > 0 && offset + displayed_max > static_cast<size_t>(item_count)) {
|
||||
if (static_cast<size_t>(item_count) >= displayed_max) {
|
||||
offset = item_count - displayed_max;
|
||||
} else {
|
||||
offset = 0;
|
||||
|
||||
Reference in New Issue
Block a user