mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-06 12:45:21 +02: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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user