[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

Eike Rathke erack at redhat.com
Wed Jun 20 20:07:05 UTC 2018


 sc/source/core/tool/formularesult.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 011a9d000e32ec55e9ef46237fc1f5a578f78f9b
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 20 18:07:54 2018 +0200

    Related: tdf#117049 treat yet unknown result as initial 0.0
    
    For the first =A1+B1 in B1 with iterations the result could had
    been #VALUE! depending on string conversion calculation settings.
    
    Change-Id: I8d7a745d67ba7a20f7a66e8aa143642d08ea5111
    Reviewed-on: https://gerrit.libreoffice.org/56173
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 93dcfa7ee157dd865f5d266d1f877014462eac72)
    Reviewed-on: https://gerrit.libreoffice.org/56179

diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx
index c1ed01516113..ad10f51a36ba 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -274,7 +274,12 @@ namespace {
 inline bool isValue( formula::StackVar sv )
 {
     return sv == formula::svDouble || sv == formula::svError
-        || sv == formula::svEmptyCell;
+        || sv == formula::svEmptyCell
+        // The initial unitialized result value is double 0.0, even if the type
+        // is unknown, so the interpreter asking for it gets that double
+        // instead of having to convert a string which may result in #VALUE!
+        // (otherwise the unknown would be neither error nor double nor string)
+        || sv == formula::svUnknown;
 }
 
 inline bool isString( formula::StackVar sv )
@@ -457,6 +462,8 @@ double ScFormulaResult::GetDouble() const
                     ;   // nothing
             }
         }
+        // Note that we reach here also for the default ctor and
+        // formula::svUnknown from GetType().
         return 0.0;
     }
     if (mbEmpty)


More information about the Libreoffice-commits mailing list