From: Vadim Zeitlin Date: Mon, 27 Nov 2006 16:36:09 +0000 (+0000) Subject: avoid assert in DoGetBestSize() for an empty tree X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/16f32ee7652c15bdbe46a85cdc0ecf036bd4003e avoid assert in DoGetBestSize() for an empty tree git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index 38d242bf06..08220fa503 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -162,7 +162,9 @@ wxSize wxTreeCtrlBase::DoGetBestSize() const else // use precise, if potentially slow, size computation method { // iterate over all items recursively - wxGetBestTreeSize(this, GetRootItem(), size); + wxTreeItemId idRoot = GetRootItem(); + if ( idRoot.IsOk() ) + wxGetBestTreeSize(this, idRoot, size); } // need some minimal size even for empty tree