]> git.saurik.com Git - wxWidgets.git/commitdiff
check the item index inside Item() itself instead of checking it inside some callers...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Sep 2008 00:04:23 +0000 (00:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Sep 2008 00:04:23 +0000 (00:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h

index 4fa1488b0ee4989cd5fcd31ba02b3d59b39ae8b0..23584a9af613914c7b288916f426a2824eb96637 100644 (file)
@@ -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;