From a8f473ac3632a6b69fd998304eb0845b86a12f87 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 12 Mar 2003 19:48:45 +0000 Subject: [PATCH] Prevent crash in case nothing is selected git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/checklst.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index db05ff7812..756293a0ed 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -418,15 +418,19 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event) if ( oper != None ) { wxArrayInt selections; - int count; + int count = 0; if ( HasMultipleSelection() ) { count = GetSelections(selections); } else { - count = 1; - selections.Add(GetSelection()); + int sel = GetSelection(); + if (sel != -1) + { + count = 1; + selections.Add(sel); + } } for ( int i = 0; i < count; i++ ) -- 2.45.2