From 925a1c0734eef56ec6a9c5d5f89f6c4285768f0a Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 24 Sep 2017 08:51:48 -0700 Subject: [PATCH] Avoid assert when deleting last item from wxListCtrl See #17959 --- src/generic/listctrl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index d229958c0f..d90989fd89 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4097,7 +4097,8 @@ void wxListMainWindow::DeleteItem( long lindex ) // with many items, the vertical scroll position may change so that the new // last item is not visible any longer, which is very annoying from the // user point of view. Ensure that whatever happens, this item is visible. - EnsureVisible(m_current); + if (count > 1) + EnsureVisible(m_current); } void wxListMainWindow::DeleteColumn( int col )