From 62e6b49c33ede253802961d7969af2917c591c06 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Jun 2000 10:16:14 +0000 Subject: [PATCH] crash in OnChar() for empty list control fixed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index de2f622607..4617c09d69 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1969,12 +1969,15 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) wxWindow *parent = GetParent(); /* we send a list_key event up */ - wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() ); - le.m_itemIndex = GetIndexOfLine( m_current ); - m_current->GetItem( 0, le.m_item ); - le.m_code = (int)event.KeyCode(); - le.SetEventObject( parent ); - parent->GetEventHandler()->ProcessEvent( le ); + if ( m_current ) + { + wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() ); + le.m_itemIndex = GetIndexOfLine( m_current ); + m_current->GetItem( 0, le.m_item ); + le.m_code = (int)event.KeyCode(); + le.SetEventObject( parent ); + parent->GetEventHandler()->ProcessEvent( le ); + } /* we propagate the char event up */ wxKeyEvent ke( wxEVT_CHAR );