From: Vadim Zeitlin Date: Sun, 14 Sep 2008 00:04:23 +0000 (+0000) Subject: check the item index inside Item() itself instead of checking it inside some callers... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/99774d589d0a0587f759eb82fa2e22900616897f check the item index inside Item() itself instead of checking it inside some callers of this function git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 4fa1488b0e..23584a9af6 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -2142,13 +2142,12 @@ public: // Delete all entries void Clear(); - size_t GetCount() const - { - return m_items.size(); - } + size_t GetCount() const { return m_items.size(); } wxPGChoiceEntry* Item( unsigned int i ) const { + wxCHECK_MSG( i < GetCount(), NULL, "invalid index" ); + return (wxPGChoiceEntry*) m_items[i]; } @@ -2291,7 +2290,6 @@ public: const wxString& GetLabel( size_t ind ) const { - wxASSERT( ind >= 0 && ind < GetCount() ); return Item(ind).GetText(); } @@ -2321,7 +2319,7 @@ public: bool HasValues() const; bool HasValue( unsigned int i ) const - { return (m_data->GetCount() > i && m_data->Item(i)->HasValue()); } + { return (i < m_data->GetCount()) && m_data->Item(i)->HasValue(); } int Index( const wxString& str ) const; int Index( int val ) const;