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
This commit is contained in:
@@ -2142,13 +2142,12 @@ public:
|
|||||||
// Delete all entries
|
// Delete all entries
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
size_t GetCount() const
|
size_t GetCount() const { return m_items.size(); }
|
||||||
{
|
|
||||||
return m_items.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPGChoiceEntry* Item( unsigned int i ) const
|
wxPGChoiceEntry* Item( unsigned int i ) const
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( i < GetCount(), NULL, "invalid index" );
|
||||||
|
|
||||||
return (wxPGChoiceEntry*) m_items[i];
|
return (wxPGChoiceEntry*) m_items[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2291,7 +2290,6 @@ public:
|
|||||||
|
|
||||||
const wxString& GetLabel( size_t ind ) const
|
const wxString& GetLabel( size_t ind ) const
|
||||||
{
|
{
|
||||||
wxASSERT( ind >= 0 && ind < GetCount() );
|
|
||||||
return Item(ind).GetText();
|
return Item(ind).GetText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2321,7 +2319,7 @@ public:
|
|||||||
bool HasValues() const;
|
bool HasValues() const;
|
||||||
|
|
||||||
bool HasValue( unsigned int i ) 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( const wxString& str ) const;
|
||||||
int Index( int val ) const;
|
int Index( int val ) const;
|
||||||
|
Reference in New Issue
Block a user