sc/source/core/tool/interpr8.cxx |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 1e3b7cbff66eb81a008eca03b56fcd128ddbe45f
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu May 19 15:52:48 2016 +0200

    SWITCH returns error if compared value contains an error, tdf#97831 
follow-up
    
    Partial revert of commit a2aea8bac55cef23297573733ba28f563f5aa791
    
    Change-Id: Ia059dd434a52e959495c0ea6ffc47e68df7a474a
    Reviewed-on: https://gerrit.libreoffice.org/25165
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 7d1349f..dcf43d2 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -1957,7 +1957,6 @@ void ScInterpreter::ScSwitch_MS()
             return;
     }
     nParamCount--;
-    sal_uInt16 nFirstMatchError = 0;
     bool bFinished = false;
     while ( nParamCount > 1 && !bFinished && !nGlobalError )
     {
@@ -1967,10 +1966,8 @@ void ScInterpreter::ScSwitch_MS()
             fVal = GetDouble();
         else
             aStr = GetString();
-        if (!nFirstMatchError)
-            nFirstMatchError = nGlobalError;
         nParamCount--;
-        if ( !nGlobalError && (( isValue && rtl::math::approxEqual( fRefVal, 
fVal ) ) ||
+        if ( nGlobalError || (( isValue && rtl::math::approxEqual( fRefVal, 
fVal ) ) ||
              ( !isValue && aRefStr.getDataIgnoreCase() == 
aStr.getDataIgnoreCase() )) )
         {
             // TRUE
@@ -1999,11 +1996,10 @@ void ScInterpreter::ScSwitch_MS()
 
     if ( nGlobalError || !bFinished  )
     {
-        nGlobalError = nFirstMatchError;
         if ( !bFinished )
             PushNA(); // no true expression found
-        if ( nGlobalError )
-            PushNoValue(); // expression returned something other than true or 
false
+        else
+            PushError( nGlobalError );
         return;
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to