Better safe than sorry

This commit is contained in:
xor 2022-02-05 14:49:16 +01:00
parent 9b53484e1c
commit 0777e00e65

View File

@ -84,7 +84,7 @@ namespace pu::ui::elm {
if(idx < this->items.size()) {
this->selected_item_idx = idx;
this->advanced_item_count = 0;
if(this->selected_item_idx >= this->items.size() - this->items_to_show) {
if(this->selected_item_idx >= (this->items.size() - this->items_to_show)) {
this->advanced_item_count = this->items.size() - this->items_to_show;
}
else if(this->selected_item_idx < this->items_to_show) {
@ -236,7 +236,7 @@ namespace pu::ui::elm {
}
}
if(move) {
if(!this->items.empty() && this->selected_item_idx < (this->items.size() - 1)) {
if(!this->items.empty() && (this->selected_item_idx < (this->items.size() - 1))) {
if((this->selected_item_idx - this->advanced_item_count) == (this->items_to_show - 1)) {
this->advanced_item_count++;
this->selected_item_idx++;