Avoid crash in SelectAll if there are no nodes besides the root

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-07-05 01:35:36 +00:00
parent 96221a45d3
commit 065fa541eb

View File

@@ -2926,7 +2926,7 @@ void wxTreeListMainWindow::SelectItem(const wxTreeItemId& itemId,
void wxTreeListMainWindow::SelectAll(bool extended_select)
{
wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style") );
wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style, must have wxTR_MULTIPLE style to select all items") );
wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() );
event.SetItem( GetRootItem() );
@@ -2954,6 +2954,7 @@ void wxTreeListMainWindow::SelectAll(bool extended_select)
wxTreeItemId root = GetRootItem();
wxTreeListItem *first = (wxTreeListItem *)GetFirstChild (root, cookie).m_pItem;
wxTreeListItem *last = (wxTreeListItem *)GetLastChild (GetRootItem()).m_pItem;
if (!first || !last) return;
if (TagAllChildrenUntilLast (first, last, true)) return;
TagNextChildren (first, last, true);