mirror of
https://github.com/libretro/ppsspp.git
synced 2025-03-04 22:49:46 +00:00
UI: Fix crash on item select with hidden items.
Because we can't assume the number is an index into the views, when some of those views weren't created.
This commit is contained in:
parent
9ea7281b3c
commit
de3c4fe111
@ -1293,7 +1293,7 @@ void ListView::CreateAllItems() {
|
||||
// Let's not be clever yet, we'll just create them all up front and add them all in.
|
||||
for (int i = 0; i < adaptor_->GetNumItems(); i++) {
|
||||
if (hidden_.find(i) == hidden_.end()) {
|
||||
View * v = linLayout_->Add(adaptor_->CreateItemView(i));
|
||||
View *v = linLayout_->Add(adaptor_->CreateItemView(i));
|
||||
adaptor_->AddEventCallback(v, std::bind(&ListView::OnItemCallback, this, i, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
@ -1315,7 +1315,7 @@ EventReturn ListView::OnItemCallback(int num, EventParams &e) {
|
||||
OnChoice.Trigger(ev);
|
||||
CreateAllItems();
|
||||
if (focused)
|
||||
SetFocusedView(linLayout_->GetViewByIndex(num));
|
||||
SetFocusedView(e.v);
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user