Fix bug in wxMSW wxMessageDialog when the text was empty.
Don't crash in ReplaceStaticWithEdit() dereferencing an invalid end()-1 iterator in this case, use the always valid rbegin() instead. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63377 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -246,11 +246,12 @@ void wxMessageDialog::ReplaceStaticWithEdit()
|
|||||||
// ignored by the static control but result in extra lines and hence extra
|
// ignored by the static control but result in extra lines and hence extra
|
||||||
// scrollbar position in the edit one
|
// scrollbar position in the edit one
|
||||||
wxString text(wxGetWindowText(hwndStatic));
|
wxString text(wxGetWindowText(hwndStatic));
|
||||||
for ( wxString::iterator i = text.end() - 1; i != text.begin(); --i )
|
for ( wxString::reverse_iterator i = text.rbegin(); i != text.rend(); ++i )
|
||||||
{
|
{
|
||||||
if ( *i != '\n' )
|
if ( *i != '\n' )
|
||||||
{
|
{
|
||||||
text.erase(i + 1, text.end());
|
// found last non-newline char, remove everything after it and stop
|
||||||
|
text.erase(i.base() + 1, text.end());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user