fix for crash in wxTreeCtrl::GetSelections() when the tree is empty
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1407,14 +1407,19 @@ void wxTreeCtrl::FillArray(wxGenericTreeItem *item,
|
||||
wxArrayGenericTreeItems& children = item->GetChildren();
|
||||
size_t count = children.GetCount();
|
||||
for ( size_t n = 0; n < count; ++n )
|
||||
FillArray(children[n],array);
|
||||
FillArray(children[n], array);
|
||||
}
|
||||
}
|
||||
|
||||
size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds &array) const
|
||||
{
|
||||
array.Empty();
|
||||
FillArray(GetRootItem().m_pItem, array);
|
||||
wxTreeItemId idRoot = GetRootItem();
|
||||
if ( idRoot.IsOk() )
|
||||
{
|
||||
FillArray(idRoot.m_pItem, array);
|
||||
}
|
||||
//else: the tree is empty, so no selections
|
||||
|
||||
return array.Count();
|
||||
}
|
||||
|
Reference in New Issue
Block a user