From: Vadim Zeitlin Date: Sun, 7 Oct 2012 22:41:38 +0000 (+0000) Subject: Fix return value of wxGenericTreeCtrl::FindItem(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e0dec8753abaf97e006ea1185bfb6775b28df0a8 Fix return value of wxGenericTreeCtrl::FindItem(). 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 --- diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 60b843a17a..323aa53db4 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1599,8 +1599,12 @@ wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent, { 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;