summaryrefslogtreecommitdiff
path: root/sal/rtl/strbuf.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-11-20 08:32:37 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-11-20 08:34:07 +0100
commit5252652ac57b3358db6cc0d423cc3d67882b5e90 (patch)
tree1bf6e38df881b05f5ca80d13981478a1f137257e /sal/rtl/strbuf.cxx
parent04ae3d0cc9b671729deabf33c2cea1031d72e6ae (diff)
Introduce OStringBuffer::appendUninitialized
...corresponding to the OUStringBuffer couterpart Change-Id: I3ab03343696e6755cf1ccc470e4decc2f41d2558
Diffstat (limited to 'sal/rtl/strbuf.cxx')
-rw-r--r--sal/rtl/strbuf.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/sal/rtl/strbuf.cxx b/sal/rtl/strbuf.cxx
index f8b1f9c6df8c..f75d0cc7ef57 100644
--- a/sal/rtl/strbuf.cxx
+++ b/sal/rtl/strbuf.cxx
@@ -114,11 +114,14 @@ void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This,
memmove( pBuf + offset + len, pBuf + offset, n * sizeof(sal_Char) );
/* insert the new characters */
- if( len == 1 )
+ if( str != nullptr )
+ {
+ if( len == 1 )
/* optimized for 1 character */
- pBuf[offset] = *str;
- else
- memcpy( pBuf + offset, str, len * sizeof(sal_Char) );
+ pBuf[offset] = *str;
+ else
+ memcpy( pBuf + offset, str, len * sizeof(sal_Char) );
+ }
(*This)->length = nOldLen + len;
pBuf[ nOldLen + len ] = 0;
}