X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8760bc6529d7e74c80ee25120274251993bc177a..22c2307c2b1cc454846d066f95e4be2e72ce61cd:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 9f97667da3..34776e1caa 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -958,8 +958,13 @@ wxString wxString::AfterFirst(wxChar ch) const } // replace first (or all) occurences of some substring with another one -size_t wxString::Replace(const wxChar *szOld, const wxChar *szNew, bool bReplaceAll) +size_t +wxString::Replace(const wxChar *szOld, const wxChar *szNew, bool bReplaceAll) { + // if we tried to replace an empty string we'd enter an infinite loop below + wxCHECK_MSG( szOld && *szOld && szNew, 0, + _T("wxString::Replace(): invalid parameter") ); + size_t uiCount = 0; // count of replacements made size_t uiOldLen = wxStrlen(szOld);