mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Fix rare crash on Linux when opening dropdowns.
Patch by: @wraitii Accepted by: @Angen Fixes #5598 Fixes #6225 Differential Revision: https://code.wildfiregames.com/D4183 This was SVN commit r25830.
This commit is contained in:
@@ -169,7 +169,10 @@ void CDropDown::HandleMessage(SGUIMessage& Message)
|
||||
m_ElementHighlight = m_Selected;
|
||||
|
||||
// Start at the position of the selected item, if possible.
|
||||
GetScrollBar(0).SetPos(m_ItemsYPositions.empty() ? 0 : m_ItemsYPositions[m_ElementHighlight] - 60);
|
||||
if (m_ItemsYPositions.empty() || m_ElementHighlight < 0 || static_cast<size_t>(m_ElementHighlight) >= m_ItemsYPositions.size())
|
||||
GetScrollBar(0).SetPos(0);
|
||||
else
|
||||
GetScrollBar(0).SetPos(m_ItemsYPositions[m_ElementHighlight] - 60);
|
||||
|
||||
PlaySound(m_SoundOpened);
|
||||
return; // overshadow
|
||||
|
||||
Reference in New Issue
Block a user