Avoid dereferencing invalid iterator in wxMessageDialog code.

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
This commit is contained in:
Vadim Zeitlin
2011-04-06 14:37:36 +00:00
parent cee25be77b
commit 3672f9d04d

View File

@@ -253,8 +253,10 @@ void wxMessageDialog::ReplaceStaticWithEdit()
{
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;
}
}