Fix annoying assertion failure in the treectrl sample

Don't pass invalid item to wxTreeCtrl::SelectItem(), just don't select
anything if there is no current item.
This commit is contained in:
Vadim Zeitlin
2018-08-25 22:30:46 +02:00
parent de33f6715d
commit 3b75bce245

View File

@@ -594,7 +594,9 @@ void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnSelect(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSelect(wxCommandEvent& WXUNUSED(event))
{ {
m_treeCtrl->SelectItem(m_treeCtrl->GetFocusedItem()); const wxTreeItemId focus = m_treeCtrl->GetFocusedItem();
if ( focus.IsOk() )
m_treeCtrl->SelectItem(focus);
} }
void MyFrame::OnSelectRoot(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSelectRoot(wxCommandEvent& WXUNUSED(event))