]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxString::replace when nLen is wxString::npos.
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Thu, 4 Oct 2007 12:50:49 +0000 (12:50 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Thu, 4 Oct 2007 12:50:49 +0000 (12:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/stringimpl.cpp

index 95d686330143ace1c9ddc08b4d8c4c16448194fe..c8799442c379b82f23d5acfb7d8f75e69f0784e4 100644 (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;