Check index value with CHECK_MSG to avoid crashes

This commit is contained in:
Artur Wieczorek
2020-02-09 20:39:06 +01:00
parent 0b7f1e7e91
commit c7c3f337c2

View File

@@ -1155,6 +1155,7 @@ public:
const wxPGCommonValue* GetCommonValue( unsigned int i ) const const wxPGCommonValue* GetCommonValue( unsigned int i ) const
{ {
wxCHECK_MSG( i < m_commonValues.size(), NULL, "Invalid item index" );
return m_commonValues[i]; return m_commonValues[i];
} }
@@ -1167,7 +1168,7 @@ public:
// Returns label of given common value. // Returns label of given common value.
wxString GetCommonValueLabel( unsigned int i ) const wxString GetCommonValueLabel( unsigned int i ) const
{ {
wxASSERT( GetCommonValue(i) ); wxCHECK_MSG( i < m_commonValues.size(), wxString(), "Invalid item index" );
return GetCommonValue(i)->GetLabel(); return GetCommonValue(i)->GetLabel();
} }