Related: tdf#111675 Clear global error for arguments if possible
... i.e. if the last result / current stack value is svError
already (usually is nowadays in case of error) and error
evaluating functions may be pending.
Change-Id: I36fc0f169d36dfa7007e8bd3a5c368ed2bb3c919
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131405
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 11353a6..9baa251 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4541,6 +4541,18 @@ StackVar ScInterpreter::Interpret()
}
if ( nErrorFunction >= nErrorFunctionCount )
++nErrorFunction; // that's it, error => terminate
else if (nErrorFunctionCount && sp && GetStackType() == svError)
{
// Clear global error if we have an individual error result, so
// an error evaluating function can receive multiple arguments
// and not all evaluated arguments inheriting the error.
// This is important for at least IFS() and SWITCH() as long as
// they are classified as error evaluating functions and not
// implemented as short-cutting jump code paths, but also for
// more than one evaluated argument to AGGREGATE() or COUNT()
// that may ignore errors.
nGlobalError = FormulaError::NONE;
}
}
}