From 481697d020078454f570a369478c80ec73179da8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 1 Nov 2007 20:41:30 +0000 Subject: [PATCH] don't crash in HiglightAll() (called, in particular, from SortItems()) when the control is empty (patch 1821550) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 747d3a0d60..9f08a1a01e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2868,9 +2868,10 @@ void wxListMainWindow::HighlightAll( bool on ) RefreshLine(m_current); } } - else // multi sel + else // multi selection { - HighlightLines(0, GetItemCount() - 1, on); + if ( !IsEmpty() ) + HighlightLines(0, GetItemCount() - 1, on); } } @@ -3105,7 +3106,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) if (event.RightDown()) { SendNotify( (size_t) -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition() ); - + wxContextMenuEvent evtCtx( wxEVT_CONTEXT_MENU, GetParent()->GetId(), @@ -5017,7 +5018,7 @@ bool wxGenericListCtrl::Create(wxWindow *parent, // add more styles here that should only appear // in the main window unsigned long only_main_window_style = wxALWAYS_SHOW_SB; - + if ( !wxControl::Create( parent, id, pos, size, style & ~only_main_window_style, validator, name ) ) return false;