summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/compressedarray.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/sc/source/core/data/compressedarray.cxx b/sc/source/core/data/compressedarray.cxx
index 28c06d9d87e4..6e8ca59bf5ac 100644
--- a/sc/source/core/data/compressedarray.cxx
+++ b/sc/source/core/data/compressedarray.cxx
@@ -215,6 +215,7 @@ template< typename A, typename D >
void ScCompressedArray<A,D>::CopyFrom( const ScCompressedArray<A,D>& rArray, A nDestStart,
A nDestEnd, A nSrcStart )
{
+ assert( this != &rArray && "cannot copy self->self" );
size_t nIndex = 0;
A nRegionEnd;
for (A j=nDestStart; j<=nDestEnd; ++j)
@@ -222,6 +223,7 @@ void ScCompressedArray<A,D>::CopyFrom( const ScCompressedArray<A,D>& rArray, A n
const D& rValue = (j==nDestStart ?
rArray.GetValue( j - nDestStart + nSrcStart, nIndex, nRegionEnd) :
rArray.GetNextValue( nIndex, nRegionEnd));
+ nRegionEnd = nRegionEnd - nSrcStart + nDestStart;
if (nRegionEnd > nDestEnd)
nRegionEnd = nDestEnd;
this->SetValue( j, nRegionEnd, rValue);