diff options
author | Eike Rathke <erack@redhat.com> | 2016-03-09 16:18:55 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-03-10 19:42:04 +0100 |
commit | 355925efcc284a254170640cd79bee4ae9fd1627 (patch) | |
tree | 3f116e62ff7afe5f99ec6d4bc9dc51112eee8373 | |
parent | b3822ee713d7f25b43f99553ada8a6f0a81e4d44 (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..
(cherry picked from commit 62b40429946c0e5021912072dc79a60fc11fce06)
Change-Id: I3559e15180694961585db92f6aa98a46430ae372
Reviewed-on: https://gerrit.libreoffice.org/23091
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 070fbda4edafb27c91c856039880099014f2b53f)
-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 44e25c7786cf..6ed55dd2fb12 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -75,6 +75,7 @@ #include <vbahelper/vbaaccesshelper.hxx> #include <memory> #include <boost/scoped_array.hpp> +#include <stack> using namespace com::sun::star; using namespace formula; @@ -3564,6 +3565,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; @@ -4094,7 +4096,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 = NULL; } while ( bGotResult ); |