Also check the old selection index for validity

It's not totally clear if the old selection is always guaranteed to be
valid so prefer to check it explicitly.
This commit is contained in:
Vadim Zeitlin
2018-06-30 23:18:28 +02:00
parent 30c798b70a
commit c53524a59b

View File

@@ -444,7 +444,7 @@ void wxListBox::MacHandleSelectionChange(int row)
if ( !m_oldSelections.empty() )
{
const int oldsel = m_oldSelections[0];
if (oldsel >= 0)
if ( oldsel >= 0 && oldsel < count )
SetSelection(oldsel);
}
}