don't crash in HiglightAll() (called, in particular, from SortItems()) when the contr...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 1 Nov 2007 20:41:30 +0000 (20:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 1 Nov 2007 20:41:30 +0000 (20:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 7e1830b570fd622376510d10ff1a2197a612b0ec..fbb923ae18fb1b0ec40c27ac49f705513f3bc52a 100644 (file)
@@ -2865,9 +2865,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);
     }
 }
 
@@ -3024,7 +3025,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(),
@@ -3107,7 +3108,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(),