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
// 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;
}
}