]> git.saurik.com Git - wxWidgets.git/commitdiff
don't crash in UnselectAll() if the tree has no root
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Jan 2002 17:39:28 +0000 (17:39 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Jan 2002 17:39:28 +0000 (17:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/treectlg.cpp

index 86535a229f259bd1632dd079e237f7b4c2287d97..64e615f681265e10b08053d1ab5fa417486ba7e5 100644 (file)
@@ -1477,7 +1477,13 @@ void wxGenericTreeCtrl::UnselectAllChildren(wxGenericTreeItem *item)
 
 void wxGenericTreeCtrl::UnselectAll()
 {
 
 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 !
 }
 
 // Recursive function !