From: Vadim Zeitlin Date: Fri, 20 Jan 2012 22:11:39 +0000 (+0000) Subject: Check that an error really occurred when getting wxChoice data in wxMSW. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/85a39457f9edb69bf287c6d244966b514ce0bdbc?ds=inline Check that an error really occurred when getting wxChoice data in wxMSW. We could wrongly return NULL client data if -1 was stored as client data in wxChoice because it's the same value as CB_ERR and we always interpreted it as an error, while it may not be one if GetLastError() doesn't indicate it. See #13883. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 34dd9b817d..8dc803b88b 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -417,7 +417,7 @@ void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) void* wxChoice::DoGetItemClientData(unsigned int n) const { LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0); - if ( rc == CB_ERR ) + if ( rc == CB_ERR && GetLastError() != ERROR_SUCCESS ) { wxLogLastError(wxT("CB_GETITEMDATA"));