Add error checking when retrieving client data from wxMSW wxListBox.
Verify if retrieving client data failed which might happen if the index is invalid for example. This makes code more robust and also consistent with wxChoice. Closes #13883. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
85a39457f9
commit
6f46510c80
@ -306,7 +306,15 @@ bool wxListBox::IsSelected(int N) const
|
||||
|
||||
void *wxListBox::DoGetItemClientData(unsigned int n) const
|
||||
{
|
||||
return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
||||
LPARAM rc = SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
||||
if ( rc == LB_ERR && GetLastError() != ERROR_SUCCESS )
|
||||
{
|
||||
wxLogLastError(wxT("LB_GETITEMDATA"));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (void *)rc;
|
||||
}
|
||||
|
||||
void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
|
||||
|
Loading…
Reference in New Issue
Block a user