Improve assert checking line index validity in wxGenericListCtrl
Don't just check that the index is not -1, but also that it's valid, which can catch other problems. Also replace the ASSERT with CHECK to avoid dereferencing invalid pointer, it's better to crash when trying to dereference a NULL one.
This commit is contained in:
parent
57c71a4547
commit
8c1234ea66
1 changed files with 1 additions and 1 deletions
|
|
@ -845,7 +845,7 @@ protected:
|
|||
// get the line data for the given index
|
||||
wxListLineData *GetLine(size_t n) const
|
||||
{
|
||||
wxASSERT_MSG( n != (size_t)-1, wxT("invalid line index") );
|
||||
wxCHECK_MSG( n < m_lines.size(), nullptr, wxT("invalid line index") );
|
||||
|
||||
wxListMainWindow *self = wxConstCast(this, wxListMainWindow);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue