Assert in wxMSW wxChoice::GetString() if the index is invalid

Do it for consistency with SetString() and other controls.
This commit is contained in:
Vadim Zeitlin
2021-01-17 00:10:23 +01:00
parent 9fe7e0a78e
commit 98aaeadf54

View File

@@ -362,10 +362,13 @@ void wxChoice::SetString(unsigned int n, const wxString& s)
wxString wxChoice::GetString(unsigned int n) const wxString wxChoice::GetString(unsigned int n) const
{ {
int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); const int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
wxString str; wxString str;
if ( len != CB_ERR && len > 0 )
wxCHECK_MSG( len != CB_ERR, str, wxS("Invalid index") );
if ( len > 0 )
{ {
if ( ::SendMessage if ( ::SendMessage
( (