don't overwrite the buffer if extending it failed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -298,6 +298,7 @@ wxStringImpl& wxStringImpl::append(size_t n, wxStringCharType ch)
|
|||||||
|
|
||||||
if ( !Alloc(len + n) || !CopyBeforeWrite() ) {
|
if ( !Alloc(len + n) || !CopyBeforeWrite() ) {
|
||||||
wxFAIL_MSG( _T("out of memory in wxStringImpl::append") );
|
wxFAIL_MSG( _T("out of memory in wxStringImpl::append") );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
GetStringData()->nDataLength = len + n;
|
GetStringData()->nDataLength = len + n;
|
||||||
m_pchData[len + n] = '\0';
|
m_pchData[len + n] = '\0';
|
||||||
@@ -419,6 +420,7 @@ wxStringImpl& wxStringImpl::insert(size_t nPos, const wxChar *sz, size_t n)
|
|||||||
|
|
||||||
if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
|
if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
|
||||||
wxFAIL_MSG( _T("out of memory in wxStringImpl::insert") );
|
wxFAIL_MSG( _T("out of memory in wxStringImpl::insert") );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(m_pchData + nPos + n, m_pchData + nPos,
|
memmove(m_pchData + nPos + n, m_pchData + nPos,
|
||||||
|
Reference in New Issue
Block a user