X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd91da4ed1e9d2ba5d3bc2fae64a8e4ea86b5d41..68698f0308f5c46966b7de12b34f68ec23dd3ec8:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 16589483c6..82cc3bd9a3 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -5,8 +5,8 @@ // Modified by: VZ at 11.12.99 (wxScrollableToolBar splitted off) // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -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; + } } }