Fix wxString::replace when nLen is wxString::npos.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell 2007-10-04 12:50:49 +00:00
parent 91a865a4fa
commit dfaae3e640

View File

@ -584,7 +584,7 @@ wxStringImpl& wxStringImpl::replace(size_t nStart, size_t nLen,
wxASSERT_MSG( nStart <= lenOld,
_T("index out of bounds in wxStringImpl::replace") );
size_t nEnd = nStart + nLen;
if ( nEnd > lenOld )
if ( nLen > lenOld - nStart )
{
// nLen may be out of range, as it can be npos, just clump it down
nLen = lenOld - nStart;