don't crash in UnselectAll() if the tree has no root

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-01-03 17:39:28 +00:00
parent 2fb203e6ef
commit 0a33446c8e

View File

@ -1477,7 +1477,13 @@ void wxGenericTreeCtrl::UnselectAllChildren(wxGenericTreeItem *item)
void wxGenericTreeCtrl::UnselectAll()
{
UnselectAllChildren((wxGenericTreeItem*) GetRootItem().m_pItem);
wxTreeItemId rootItem = GetRootItem();
// the tree might not have the root item at all
if ( rootItem )
{
UnselectAllChildren((wxGenericTreeItem*) rootItem.m_pItem);
}
}
// Recursive function !