Merge pull request #20640 from ZehMatt/fix-20635

Fix #20635: Crash when filtering track designs
This commit is contained in:
Matthias Moninger 2023-07-19 15:49:41 +03:00 committed by GitHub
commit 9616424473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -106,6 +106,12 @@ private:
_filteredTrackIds.push_back(i);
}
}
// Ensure that the selected item is still in the list.
if (static_cast<size_t>(selected_list_item) >= _filteredTrackIds.size())
{
selected_list_item = 0;
}
}
void SelectFromList(int32_t listIndex)
@ -452,7 +458,7 @@ public:
}
else
{
if (listItemIndex == 0)
if (_filteredTrackIds.empty() || listItemIndex == 0)
return;
// Because the first item in the list is "Build a custom design", lower the index by one