]> git.saurik.com Git - wxWidgets.git/commitdiff
Change the loop condition to avoid comparing unsigned value with 0.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 29 Jun 2011 17:50:32 +0000 (17:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 29 Jun 2011 17:50:32 +0000 (17:50 +0000)
This resulted in (useful) g++ warning and didn't make any sense in any case.

Check for the loop variable value being 0 at the end of the loop instead now.
If the old code was correct it shouldn't change its behaviour and if not, this
might fix a bug.

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

src/generic/datavgen.cpp

index 7f75fdacd5cc96b99ec96c295351aa418549b4dd..44b0bd4ef83bce2d75b688356c19166899ad4d7b 100644 (file)
@@ -3029,7 +3029,7 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item
     // Find the item along the parent-chain.
     // This algorithm is designed to speed up the node-finding method
     wxDataViewTreeNode* node = m_root;
-    for( unsigned iter = parentChain.size()-1; iter>=0; --iter )
+    for( unsigned iter = parentChain.size()-1; ; --iter )
     {
         if( node->HasChildren() )
         {
@@ -3060,6 +3060,9 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item
         }
         else
             return NULL;
+
+        if ( !iter )
+            break;
     }
     return NULL;
 }