The iterator wxString::rbegin().base()+1 is invalid so check that we don't use
it.
Closes #13126.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67407
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
if ( *i != '\n' )
{
- // found last non-newline char, remove everything after it and stop
- text.erase(i.base() + 1, text.end());
+ // found last non-newline char, remove anything after it if
+ // necessary and stop in any case
+ if ( i != text.rbegin() )
+ text.erase(i.base() + 1, text.end());
break;
}
}