From 0436cebd82dcc5041211e91eaff602c80d2bdd48 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Jul 2023 15:23:40 +0200 Subject: [PATCH] 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. --- include/wx/generic/private/listctrl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/wx/generic/private/listctrl.h b/include/wx/generic/private/listctrl.h index 53ac7843ab..4369446cce 100644 --- a/include/wx/generic/private/listctrl.h +++ b/include/wx/generic/private/listctrl.h @@ -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]; }