diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 69d5bf1ee9..5e9ea0f289 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -523,11 +523,10 @@ wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const // find by position wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const { - wxASSERT ( position > -1 && position < m_items.GetCount() ); - if ( position > -1 && position < m_items.GetCount() ) - return m_items.Item( position )->GetData(); - else - return NULL; + wxCHECK_MSG( position < m_items.GetCount(), NULL, + _T("wxMenu::FindItemByPosition(): invalid menu index") ); + + return m_items.Item( position )->GetData(); } // ----------------------------------------------------------------------------