check parmateres in Replace() (bug 752716)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-06-15 19:33:04 +00:00
parent 5d8f5f875e
commit a8f1f1b23b

View File

@ -958,8 +958,13 @@ wxString wxString::AfterFirst(wxChar ch) const
} }
// replace first (or all) occurences of some substring with another one // 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 uiCount = 0; // count of replacements made
size_t uiOldLen = wxStrlen(szOld); size_t uiOldLen = wxStrlen(szOld);