Fix to prevent Assert when there is an empty string in a combobox/choice.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -154,14 +154,14 @@ int wxChoice::FindString(const wxString& s) const
|
|||||||
wxString wxChoice::GetString(int n) const
|
wxString wxChoice::GetString(int n) const
|
||||||
{
|
{
|
||||||
size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
|
size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
|
||||||
wxString str;
|
wxString str = "";
|
||||||
|
if (len) {
|
||||||
if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
|
if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
|
||||||
(LPARAM)str.GetWriteBuf(len)) == CB_ERR )
|
(LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
|
||||||
{
|
|
||||||
wxLogLastError("SendMessage(CB_GETLBTEXT)");
|
wxLogLastError("SendMessage(CB_GETLBTEXT)");
|
||||||
}
|
}
|
||||||
|
|
||||||
str.UngetWriteBuf();
|
str.UngetWriteBuf();
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user