Skip to content

Commit

Permalink
Fixed a possible crash when the index is not reset on a search field
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed Apr 1, 2024
1 parent bbc7213 commit 6a0dae4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/ui/MI_SelectField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,16 @@ T MI_SelectField<T>::randomValue() const
template<typename T>
bool MI_SelectField<T>::setCurrentValue(T value)
{
const size_t prev_idx = m_index;

for (m_index = 0; m_index < m_items.size(); m_index++) {
if (m_items[m_index].value == value) {
updateOutput();
return true;
}
}

m_index = prev_idx;
return false;
}

Expand Down

0 comments on commit 6a0dae4

Please sign in to comment.