summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r--sc/source/filter/excel/xestream.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index d6d729ce1de2..4e2798e06ee9 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -861,10 +861,10 @@ OUString XclXmlUtils::ToOUString( const char* s )
OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sal_Int32 nLength )
{
- if( nLength == -1 )
- nLength = rBuf.size();
+ if( nLength == -1 || ( nLength > (rBuf.size() - nStart) ) )
+ nLength = (rBuf.size() - nStart);
- return OUString( &rBuf[nStart], nLength );
+ return (nLength > 0) ? OUString( &rBuf[nStart], nLength ) : OUString();
}
OUString XclXmlUtils::ToOUString( const String& s )