]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed setting selection when there are NULL pages in the tree
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 May 2006 00:36:57 +0000 (00:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 May 2006 00:36:57 +0000 (00:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38979 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/treebkg.cpp

index 32e8250290f98a3cdc5fc4ba55a8b4b3508c5f55..5f86245e7e90061b73a3354c4f3af6b003aafe93 100644 (file)
@@ -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 )