Prevent crash in case nothing is selected

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-12 19:48:45 +00:00
parent 7ed2b47bf5
commit a8f473ac36

View File

@@ -418,15 +418,19 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event)
if ( oper != None ) if ( oper != None )
{ {
wxArrayInt selections; wxArrayInt selections;
int count; int count = 0;
if ( HasMultipleSelection() ) if ( HasMultipleSelection() )
{ {
count = GetSelections(selections); count = GetSelections(selections);
} }
else else
{ {
count = 1; int sel = GetSelection();
selections.Add(GetSelection()); if (sel != -1)
{
count = 1;
selections.Add(sel);
}
} }
for ( int i = 0; i < count; i++ ) for ( int i = 0; i < count; i++ )