]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed spurious assert in FindControl() (fixes patch 696147)
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 3 Mar 2003 00:00:52 +0000 (00:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 3 Mar 2003 00:00:52 +0000 (00:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/tbarbase.cpp

index 16589483c649c365cd3b5d6a6fbe861012be0520..e2a1ccd70f5010560bee1806619d4264612ca6b3 100644 (file)
@@ -229,12 +229,20 @@ wxControl *wxToolBarBase::FindControl( int id )
           node;
           node = node->GetNext() )
     {
-        wxControl *control = node->GetData()->GetControl();
-
-        if (control)
+        const wxToolBarToolBase * const tool = node->GetData();
+        if ( tool->IsControl() )
         {
-            if (control->GetId() == id)
+            wxControl * const control = tool->GetControl();
+
+            if ( !control )
+            {
+                wxFAIL_MSG( _T("NULL control in toolbar?") );
+            }
+            else if ( control->GetId() == id )
+            {
+                // found
                 return control;
+            }
         }
     }