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:
parent
2dcf60dab4
commit
d3019e4d0a
@ -246,11 +246,12 @@ void wxMessageDialog::ReplaceStaticWithEdit()
|
||||
// ignored by the static control but result in extra lines and hence extra
|
||||
// scrollbar position in the edit one
|
||||
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' )
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user