summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-05-03 19:12:17 +0200
committerEike Rathke <erack@redhat.com>2016-05-03 19:15:53 +0200
commita2aea8bac55cef23297573733ba28f563f5aa791 (patch)
tree252bfe8dd06ed1b6c76b175e97b69f1924a6b976
parentbc4d465484c67fa27d6c59807176d5f57155d9f5 (diff)
IFS/SWITCH propagate error only for active paths, tdf#97831 follow-up
Change-Id: Ief07f0d582e2f283a3ede88a7d202e8cff0e14bf
-rw-r--r--sc/source/core/tool/interpr4.cxx2
-rw-r--r--sc/source/core/tool/interpr8.cxx12
2 files changed, 12 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 3cc7c9eead82..684913b3601a 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3601,6 +3601,8 @@ bool IsErrFunc(OpCode oc)
case ocIfError :
case ocIfNA :
case ocErrorType_ODF :
+ case ocIfs_MS:
+ case ocSwitch_MS:
return true;
default:
return false;
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 771210e8517c..58e94cfb6742 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -1872,6 +1872,7 @@ void ScInterpreter::ScIfs_MS()
ReverseStack( nParamCount );
+ nGlobalError = 0; // propagate only for condition or active result path
bool bFinished = false;
while ( nParamCount > 0 && !bFinished && !nGlobalError )
{
@@ -1930,6 +1931,7 @@ void ScInterpreter::ScSwitch_MS()
ReverseStack( nParamCount );
+ nGlobalError = 0; // propagate only for match or active result path
bool isValue = false;
double fRefVal = 0;
svl::SharedString aRefStr;
@@ -1968,6 +1970,7 @@ void ScInterpreter::ScSwitch_MS()
return;
}
nParamCount--;
+ sal_uInt16 nFirstMatchError = 0;
bool bFinished = false;
while ( nParamCount > 1 && !bFinished && !nGlobalError )
{
@@ -1977,14 +1980,17 @@ void ScInterpreter::ScSwitch_MS()
fVal = GetDouble();
else
aStr = GetString();
+ if (!nFirstMatchError)
+ nFirstMatchError = nGlobalError;
nParamCount--;
- if ( ( isValue && rtl::math::approxEqual( fRefVal, fVal ) ) ||
- ( !isValue && aRefStr.getDataIgnoreCase() == aStr.getDataIgnoreCase() ) )
+ if ( !nGlobalError && (( isValue && rtl::math::approxEqual( fRefVal, fVal ) ) ||
+ ( !isValue && aRefStr.getDataIgnoreCase() == aStr.getDataIgnoreCase() )) )
{
// TRUE
if ( nParamCount < 1 )
{
// no parameter given for THEN
+ nGlobalError = nFirstMatchError;
PushParameterExpected();
return;
}
@@ -2007,11 +2013,13 @@ void ScInterpreter::ScSwitch_MS()
PushNA();
return;
}
+ nGlobalError = 0;
}
}
if ( nGlobalError || !bFinished )
{
+ nGlobalError = nFirstMatchError;
if ( !bFinished )
PushNA(); // no true expression found
if ( nGlobalError )