From 704bc4363b87a6e43368bd212749781e975eb820 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 23 Mar 2008 20:20:46 +0000 Subject: [PATCH] fix crash when pressing Up key in empty combobox git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/odcombo.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index d79d692b18..d04d183089 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -246,8 +246,14 @@ void wxVListBoxComboPopup::SendComboBoxEvent( int selection ) // returns true if key was consumed bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar unicode ) { + const int itemCount = GetCount(); + + // keys do nothing in the empty control and returning immediately avoids + // using invalid indices below + if ( !itemCount ) + return false; + int value = m_value; - int itemCount = GetCount(); int comboStyle = m_combo->GetWindowStyle(); // this is the character equivalent of the code -- 2.45.2