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
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)