summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-10-07 20:56:23 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-10-08 10:31:17 +0000
commitbfd51e38599d717a3c1b19acd882b52175dd3d09 (patch)
treeeba5d264664f78348d5f8bc6ecb005bad0439cb1
parent06a66af0b754b62f18783c77410c7929f8134941 (diff)
Resolves: tdf#94869 propagate error when obtaining a scalar double value
... if any operation like popping a value or calculating an intersection resulted in error, so the error gets passed as double error to matrix operations where one operand is a scalar value. Change-Id: I909ba25545625b827ce790e07d1ebe8643154703 (cherry picked from commit 934e47958c78d1184beaaefdf3baefd3eecbea05) Reviewed-on: https://gerrit.libreoffice.org/19235 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/tool/interpr4.cxx22
1 files changed, 15 insertions, 7 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 9d4821c2f7f3..e3517439c3d4 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1082,7 +1082,7 @@ double ScInterpreter::PopDouble()
}
else
SetError( errUnknownStackVariable);
- return 0.0;
+ return CreateDoubleError( nGlobalError);
}
svl::SharedString ScInterpreter::PopString()
@@ -2186,7 +2186,10 @@ bool ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r
double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat)
{
if (!pMat)
- return 0.0;
+ {
+ SetError( errParameterExpected);
+ return CreateDoubleError( nGlobalError);
+ }
if ( !pJumpMatrix )
return pMat->GetDouble( 0 );
@@ -2199,7 +2202,7 @@ double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat)
return pMat->GetDouble( nC, nR);
SetError( errNoValue);
- return 0.0;
+ return CreateDoubleError( nGlobalError);
}
double ScInterpreter::GetDouble()
@@ -2233,8 +2236,6 @@ double ScInterpreter::GetDouble()
aCell.assign(*pDok, aAdr);
nVal = GetCellValue(aAdr, aCell);
}
- else
- nVal = 0.0;
}
break;
case svExternalSingleRef:
@@ -2263,7 +2264,6 @@ double ScInterpreter::GetDouble()
break;
case svError:
PopError();
- nVal = 0.0;
break;
case svEmptyCell:
case svMissing:
@@ -2273,8 +2273,16 @@ double ScInterpreter::GetDouble()
default:
PopError();
SetError( errIllegalParameter);
- nVal = 0.0;
}
+
+ // Propagate error also as double error, so matrix operations where one
+ // operand is a scalar get that propagated if there is no specific
+ // nGlobalError check, and when the matrix is pushed the error is cleared
+ // because the matrix is assumed to hold double errors at the corresponding
+ // positions. See PushMatrix().
+ if (nGlobalError)
+ nVal = CreateDoubleError( nGlobalError);
+
if ( nFuncFmtType == nCurFmtType )
nFuncFmtIndex = nCurFmtIndex;
return nVal;