X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9ac6ff7b808a3141cb1e3ddcb1168b8c06bf3331..8c1c5302f3ac9e09703dbf29f45e9d3699b7a4d6:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index c6a9f7909f..90714d1e5a 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -318,15 +318,18 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) } int n = GetSelection(); - wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId); - event.SetInt(n); - event.SetEventObject(this); - event.SetString(GetStringSelection()); - if ( HasClientObjectData() ) - event.SetClientObject( GetClientObject(n) ); - else if ( HasClientUntypedData() ) - event.SetClientData( GetClientData(n) ); - ProcessCommand(event); + if (n > -1) + { + wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId); + event.SetInt(n); + event.SetEventObject(this); + event.SetString(GetStringSelection()); + if ( HasClientObjectData() ) + event.SetClientObject( GetClientObject(n) ); + else if ( HasClientUntypedData() ) + event.SetClientData( GetClientData(n) ); + ProcessCommand(event); + } return TRUE; }