From: Ryan Norton Date: Wed, 13 Oct 2004 02:54:32 +0000 (+0000) Subject: crush compiler warnings and handle out of memory errors slightly better X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/49dcf8bfb80ab5571f81b57f86051a6f4fcad677?ds=inline crush compiler warnings and handle out of memory errors slightly better git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/string.cpp b/src/common/string.cpp index a0b087ce07..b006012042 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1133,10 +1133,14 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength) size_t nActualLength = wxWcstr(buffer, psz, nLen, conv); if ( !Alloc(nActualLength + 1) ) + { wxFAIL_MSG(wxT("Out of memory in wxString")); - - //Copy the data - assign(buffer.data(), nActualLength); + } + else + { + //Copy the data + assign(buffer.data(), nActualLength); + } } } @@ -1198,10 +1202,14 @@ wxString::wxString(const wchar_t *pwz, wxMBConv& conv, size_t nLength) size_t nActualLength = wxMbstr(buffer, pwz, nLen, conv); if ( !Alloc(nActualLength + 1) ) + { wxFAIL_MSG(wxT("Out of memory in wxString")); - - //copy the data - assign(buffer.data(), nActualLength); + } + else + { + //copy the data + assign(buffer.data(), nActualLength); + } } }