mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
ConfigControl fix: Add invalid index check to ConfigComplexChoice. Resolve with a default index that can be set.
If more control is needed, it could be changed to allow multiple states to point to the same index.
This commit is contained in:
@ -153,13 +153,23 @@ void ConfigComplexChoice::UpdateComboIndex()
|
||||
};
|
||||
|
||||
auto it = std::find_if(m_options.begin(), m_options.end(), is_correct_option);
|
||||
int index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
int index;
|
||||
|
||||
if (it == m_options.end())
|
||||
index = m_default_index;
|
||||
else
|
||||
index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
|
||||
// Will crash if not blocked
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::SetDefault(int index)
|
||||
{
|
||||
m_default_index = index;
|
||||
}
|
||||
|
||||
const std::pair<Config::Location, Config::Location> ConfigComplexChoice::GetLocation() const
|
||||
{
|
||||
auto visit = [](auto& v) { return v.GetLocation(); };
|
||||
|
Reference in New Issue
Block a user