From 0a33446c8e71292bfdb960ed7e26e1f196938cf0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 3 Jan 2002 17:39:28 +0000 Subject: [PATCH] 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 --- src/generic/treectlg.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 86535a229f..64e615f681 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -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 ! -- 2.47.2