diff --git a/src/common/string.cpp b/src/common/string.cpp index c2b2292b1c..2d30e939ee 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1244,17 +1244,17 @@ wxString wxString::Mid(size_t nFirst, size_t nCount) const } // out-of-bounds requests return sensible things - if ( nFirst + nCount > nLen ) - { - nCount = nLen - nFirst; - } - if ( nFirst > nLen ) { // AllocCopy() will return empty string return wxEmptyString; } + if ( nCount > nLen - nFirst ) + { + nCount = nLen - nFirst; + } + wxString dest(*this, nFirst, nCount); if ( dest.length() != nCount ) {