sc/source/core/tool/interpr4.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 3161a6c351a2f5f70c0420ee8cccf2eb23de1ecf
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Mon Oct 16 20:35:13 2023 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Mon Oct 16 23:35:02 2023 +0200

    Resolves: tdf#157797 Let GetCellValue() propagate previous error, if any
    
    Change-Id: I27ee8d19e4f45bef81e133c82ac17b825790208f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158064
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 0ac2e151f5cc..95dff9f1cc18 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -181,7 +181,9 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, 
ScRefCellValue& rCell
     FormulaError nErr = nGlobalError;
     nGlobalError = FormulaError::NONE;
     double nVal = GetCellValueOrZero(rPos, rCell);
-    if ( nGlobalError == FormulaError::NONE || nGlobalError == 
FormulaError::CellNoValue )
+    // Propagate previous error, if any; nGlobalError==CellNoValue is not an
+    // error here, preserve previous error or non-error.
+    if (nErr != FormulaError::NONE || nGlobalError == 
FormulaError::CellNoValue)
         nGlobalError = nErr;
     return nVal;
 }

Reply via email to