Kaydet (Commit) 934e4795 authored tarafından Eike Rathke's avatar Eike Rathke

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
üst 99b935ff
...@@ -821,7 +821,7 @@ double ScInterpreter::PopDouble() ...@@ -821,7 +821,7 @@ double ScInterpreter::PopDouble()
} }
else else
SetError( errUnknownStackVariable); SetError( errUnknownStackVariable);
return 0.0; return CreateDoubleError( nGlobalError);
} }
svl::SharedString ScInterpreter::PopString() svl::SharedString ScInterpreter::PopString()
...@@ -1925,7 +1925,10 @@ bool ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r ...@@ -1925,7 +1925,10 @@ bool ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r
double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat) double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat)
{ {
if (!pMat) if (!pMat)
return 0.0; {
SetError( errParameterExpected);
return CreateDoubleError( nGlobalError);
}
if ( !pJumpMatrix ) if ( !pJumpMatrix )
return pMat->GetDouble( 0 ); return pMat->GetDouble( 0 );
...@@ -1938,7 +1941,7 @@ double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat) ...@@ -1938,7 +1941,7 @@ double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat)
return pMat->GetDouble( nC, nR); return pMat->GetDouble( nC, nR);
SetError( errNoValue); SetError( errNoValue);
return 0.0; return CreateDoubleError( nGlobalError);
} }
double ScInterpreter::GetDouble() double ScInterpreter::GetDouble()
...@@ -1972,8 +1975,6 @@ double ScInterpreter::GetDouble() ...@@ -1972,8 +1975,6 @@ double ScInterpreter::GetDouble()
aCell.assign(*pDok, aAdr); aCell.assign(*pDok, aAdr);
nVal = GetCellValue(aAdr, aCell); nVal = GetCellValue(aAdr, aCell);
} }
else
nVal = 0.0;
} }
break; break;
case svExternalSingleRef: case svExternalSingleRef:
...@@ -2002,7 +2003,6 @@ double ScInterpreter::GetDouble() ...@@ -2002,7 +2003,6 @@ double ScInterpreter::GetDouble()
break; break;
case svError: case svError:
PopError(); PopError();
nVal = 0.0;
break; break;
case svEmptyCell: case svEmptyCell:
case svMissing: case svMissing:
...@@ -2012,8 +2012,16 @@ double ScInterpreter::GetDouble() ...@@ -2012,8 +2012,16 @@ double ScInterpreter::GetDouble()
default: default:
PopError(); PopError();
SetError( errIllegalParameter); 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 ) if ( nFuncFmtType == nCurFmtType )
nFuncFmtIndex = nCurFmtIndex; nFuncFmtIndex = nCurFmtIndex;
return nVal; return nVal;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment