From a425518dc40b5fa9b8a171f402b89fb9c5a1e547 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 9 Oct 2006 18:37:33 +0000 Subject: [PATCH] assert if wxString(void* pStart,void *pEnd) ctor is used incorrectly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/string.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/string.cpp b/src/common/string.cpp index 5770917d5f..1cb717510f 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -174,8 +174,16 @@ void wxStringBase::InitWith(const wxChar *psz, size_t nPos, size_t nLength) // poor man's iterators are "void *" pointers wxStringBase::wxStringBase(const void *pStart, const void *pEnd) { - InitWith((const wxChar *)pStart, 0, - (const wxChar *)pEnd - (const wxChar *)pStart); + if ( pEnd > pStart ) + { + InitWith((const wxChar *)pStart, 0, + (const wxChar *)pEnd - (const wxChar *)pStart); + } + else + { + wxFAIL_MSG( _T("pStart is not before pEnd") ); + Init(); + } } wxStringBase::wxStringBase(size_type n, wxChar ch) -- 2.45.2