Fix recently broken assert for virtual wxGenericListCtrl

The changes of 8c1234ea66 (Improve assert checking line index validity
in wxGenericListCtrl, 2023-07-24) were wrong for virtual list controls
as the lines vector is not used for them, so restrict the assert to the
non-virtual case only.
This commit is contained in:
Vadim Zeitlin 2023-07-24 15:23:40 +02:00
parent 66cb7089f8
commit 0436cebd82

View file

@ -845,15 +845,16 @@ protected:
// get the line data for the given index
wxListLineData *GetLine(size_t n) const
{
wxCHECK_MSG( n < m_lines.size(), nullptr, wxT("invalid line index") );
wxListMainWindow *self = wxConstCast(this, wxListMainWindow);
if ( IsVirtual() )
{
self->CacheLineData(n);
n = 0;
}
else
{
wxCHECK_MSG( n < m_lines.size(), nullptr, wxT("invalid line index") );
}
return &self->m_lines[n];
}