Prevent crash in case nothing is selected
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -298,7 +298,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return wxListBox::Create(parent, id, pos, size, n, choices,
|
return wxListBox::Create(parent, id, pos, size, n, choices,
|
||||||
style | wxLB_OWNERDRAW, validator, name);
|
style | wxLB_OWNERDRAW, validator, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxCheckListBox::Delete(int N)
|
void wxCheckListBox::Delete(int N)
|
||||||
@@ -408,15 +408,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++ )
|
||||||
|
Reference in New Issue
Block a user