From: Vadim Zeitlin Date: Wed, 3 May 2006 00:36:57 +0000 (+0000) Subject: fixed setting selection when there are NULL pages in the tree X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6bd02a4367b1c1dd37a7242809e359fed54a2119 fixed setting selection when there are NULL pages in the tree git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38979 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/treebkg.cpp b/src/generic/treebkg.cpp index 32e8250290..5f86245e7e 100644 --- a/src/generic/treebkg.cpp +++ b/src/generic/treebkg.cpp @@ -614,18 +614,18 @@ int wxTreebook::DoSetSelection(size_t pagePos) // find the next page suitable to be shown: the first (grand)child // of this one with a non-NULL associated page wxTreeItemId childId = m_treeIds[pagePos]; - m_actualSelection = pagePos; + int actualPagePos = pagePos; while ( !page && childId.IsOk() ) { wxTreeItemIdValue cookie; childId = tree->GetFirstChild( childId, cookie ); if ( childId.IsOk() ) { - page = wxBookCtrlBase::GetPage(++m_actualSelection); + page = wxBookCtrlBase::GetPage(++actualPagePos); } } - wxASSERT_MSG( page, wxT("no page to show found!") ); + m_actualSelection = page ? actualPagePos : m_selection; } if ( page )