sc/source/core/tool/interpr4.cxx |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 63b237e1e8147f54e6d4db4671f612a656200e2f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Apr 13 16:35:28 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Apr 13 21:28:44 2024 +0200

    Related: tdf#160056 don't set nVal twice
    
    Change-Id: I0da3e0c7f18271f6104d52b50d65e96564650b8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166054
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 77dbd7d52014..27f2211b9f30 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2099,7 +2099,7 @@ double ScInterpreter::GetDoubleFromMatrix(const 
ScMatrixRef& pMat)
 
 double ScInterpreter::GetDouble()
 {
-    double nVal(0.0);
+    double nVal;
     switch( GetRawStackType() )
     {
         case svDouble:
@@ -2134,13 +2134,16 @@ double ScInterpreter::GetDouble()
         {
             ScExternalRefCache::TokenRef pToken;
             PopExternalSingleRef(pToken);
-            if (nGlobalError == FormulaError::NONE)
+            if (nGlobalError != FormulaError::NONE)
             {
-                if (pToken->GetType() == svDouble || pToken->GetType() == 
svEmptyCell)
-                    nVal = pToken->GetDouble();
-                else
-                    nVal = ConvertStringToValue( 
pToken->GetString().getString());
+                nVal = 0.0;
+                break;
             }
+
+            if (pToken->GetType() == svDouble || pToken->GetType() == 
svEmptyCell)
+                nVal = pToken->GetDouble();
+            else
+                nVal = ConvertStringToValue( pToken->GetString().getString());
         }
         break;
         case svExternalDoubleRef:
@@ -2148,7 +2151,10 @@ double ScInterpreter::GetDouble()
             ScMatrixRef pMat;
             PopExternalDoubleRef(pMat);
             if (nGlobalError != FormulaError::NONE)
+            {
+                nVal = 0.0;
                 break;
+            }
 
             nVal = GetDoubleFromMatrix(pMat);
         }

Reply via email to