diff options
author | Eike Rathke <erack@redhat.com> | 2016-03-09 16:18:55 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-03-09 16:35:22 +0100 |
commit | 62b40429946c0e5021912072dc79a60fc11fce06 (patch) | |
tree | 18476ec004cc5f2c530e71423e0b033a42075526 | |
parent | 5b3f84cec471ddbde98a46220096cdb952bb1935 (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
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 107158eb8757..28691339235b 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; @@ -3572,6 +3573,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; @@ -4113,7 +4115,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 ); |