X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42f25dcfc725bea1ec5cc634af28cad26f34d39e..49dcf8bfb80ab5571f81b57f86051a6f4fcad677:/src/common/string.cpp 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); + } } }