summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/interpr5.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/interpr5.cxx')
-rw-r--r--sc/source/core/tool/interpr5.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index ba4322a3281a..73794cf15b2d 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -310,6 +310,9 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" );
ScMatrix* pMat = new ScMatrix( nC, nR);
pMat->SetErrorInterpreter( this);
+ // A temporary matrix is mutable and ScMatrix::CloneIfConst() returns the
+ // very matrix.
+ pMat->SetImmutable( false);
SCSIZE nCols, nRows;
pMat->GetDimensions( nCols, nRows);
if ( nCols != nC || nRows != nR )
@@ -2069,23 +2072,25 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE
{
PushIllegalArgument();
return false;
- } // if (!pMatY->IsValue(i))
- } // for ( SCSIZE i = 0; i < nCountY; i++ )
+ }
+ }
+
if ( _bLOG )
{
+ ScMatrixRef pNewY = pMatY->CloneIfConst();
for (SCSIZE nElem = 0; nElem < nCountY; nElem++)
{
- const double fVal = pMatY->GetDouble(nElem);
+ const double fVal = pNewY->GetDouble(nElem);
if (fVal <= 0.0)
{
PushIllegalArgument();
return false;
}
else
- pMatY->PutDouble(log(fVal), nElem);
- } // for (nElem = 0; nElem < nCountY; nElem++)
- } // if ( _bRKP )
-
+ pNewY->PutDouble(log(fVal), nElem);
+ }
+ pMatY = pNewY;
+ }
if (pMatX)
{