]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix return value of wxGenericTreeCtrl::FindItem().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Oct 2012 22:41:38 +0000 (22:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Oct 2012 22:41:38 +0000 (22:41 +0000)
We incorrectly returned the item we started from instead of invalid item if
there was no match, fix this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/treectlg.cpp

index 60b843a17a13e38a7271f09f7ca99a1b703f15e3..323aa53db444ef5a4bbfcb88fad57dbbfc81dfba 100644 (file)
@@ -1599,8 +1599,12 @@ wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent,
         {
             itemid = GetNext(itemid);
         }
         {
             itemid = GetNext(itemid);
         }
-        // If we haven't found the item, id.IsOk() will be false, as per
-        // documentation
+        // If we haven't found the item but wrapped back to the one we started
+        // from, id.IsOk() must be false
+        if ( itemid == idParent )
+        {
+            itemid = wxTreeItemId();
+        }
     }
 
     return itemid;
     }
 
     return itemid;