summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-03-09 16:18:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-03-09 16:18:38 +0000
commitac4560a37dacfa4fee60e36d1b3de7790b81dc20 (patch)
tree57b53410f1f808f41c962840ec88dac37a31a470
parent9fb382d4e6afd40f8c50981cac3cbea9334b5639 (diff)
Resolves: tdf#95226 second case, stack error count in JumpMatrix context
For the early bail out on errors to work correctly and not prematurely end calculations the current error function needs to be stacked in JumpMatrix context, otherwise we may end up with ((nErrorFunction=74)>=(nErrorFunctionCount=2)) or some such.. Change-Id: I3559e15180694961585db92f6aa98a46430ae372 (cherry picked from commit 62b40429946c0e5021912072dc79a60fc11fce06) Reviewed-on: https://gerrit.libreoffice.org/23089 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/tool/interpr4.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index cc0b4bcefabc..011d9c9070d7 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -74,6 +74,7 @@
#include <basic/basmgr.hxx>
#include <vbahelper/vbaaccesshelper.hxx>
#include <memory>
+#include <stack>
using namespace com::sun::star;
using namespace formula;
@@ -3557,6 +3558,7 @@ StackVar ScInterpreter::Interpret()
sal_uLong nRetIndexExpr = 0;
sal_uInt16 nErrorFunction = 0;
sal_uInt16 nErrorFunctionCount = 0;
+ std::stack<sal_uInt16> aErrorFunctionStack;
sal_uInt16 nStackBase;
nGlobalError = 0;
@@ -4089,7 +4091,19 @@ StackVar ScInterpreter::Interpret()
else
nLevel = 0;
if ( nLevel == 1 || (nLevel == 2 && aCode.IsEndOfPath()) )
+ {
+ if (nLevel == 1)
+ aErrorFunctionStack.push( nErrorFunction);
bGotResult = JumpMatrix( nLevel );
+ if (aErrorFunctionStack.empty())
+ assert(!"ScInterpreter::Interpret - aErrorFunctionStack empty in JumpMatrix context");
+ else
+ {
+ nErrorFunction = aErrorFunctionStack.top();
+ if (bGotResult)
+ aErrorFunctionStack.pop();
+ }
+ }
else
pJumpMatrix = nullptr;
} while ( bGotResult );