Avoids asserts in the listctrl sample on pressing Ctrl-I
Calling InsertItemInReportView() with invalid index results in a series of asserts, so avoid doing this. Note that there seems to be an unrelated bug in wxGTK which results in this code being executed at all, as normally the definition of a menu item using Ctrl-I as an accelerator should have prevented this from happening.
This commit is contained in:
parent
5ae2a8ebb8
commit
a2ebe1928a
@ -1435,7 +1435,10 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
||||
}
|
||||
else // !virtual
|
||||
{
|
||||
InsertItemInReportView(event.GetIndex());
|
||||
int idx = event.GetIndex();
|
||||
if ( idx == -1 )
|
||||
idx = 0;
|
||||
InsertItemInReportView(idx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user