[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source
Eike Rathke
erack at redhat.com
Wed Mar 9 16:19:01 UTC 2016
sc/source/core/tool/interpr4.cxx | 14 ++++++++++++++
1 file changed, 14 insertions(+)
New commits:
commit ac4560a37dacfa4fee60e36d1b3de7790b81dc20
Author: Eike Rathke <erack at redhat.com>
Date: Wed Mar 9 16:18:55 2016 +0100
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index cc0b4bc..011d9c9 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 );
More information about the Libreoffice-commits
mailing list