Resolves: tdf#100768 accept empty missing argument also for first parameter
... and let the interpreter decide about validity. Only if at least two
parameters are given, empty/omitted or not.
Change-Id: I2d7070e56f616b1940ff577c43e257eabb81b412
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2ed3d59..8cb9534 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4408,17 +4408,19 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
default:
break;
}
if( (eLastOp == ocSep ||
eLastOp == ocArrayRowSep ||
eLastOp == ocArrayColSep ||
eLastOp == ocArrayOpen) &&
(eOp == ocSep ||
eOp == ocClose ||
eOp == ocArrayRowSep ||
eOp == ocArrayColSep ||
eOp == ocArrayClose) )
if (!(eLastOp == ocOpen && eOp == ocClose) &&
(eLastOp == ocOpen ||
eLastOp == ocSep ||
eLastOp == ocArrayRowSep ||
eLastOp == ocArrayColSep ||
eLastOp == ocArrayOpen) &&
(eOp == ocSep ||
eOp == ocClose ||
eOp == ocArrayRowSep ||
eOp == ocArrayColSep ||
eOp == ocArrayClose))
{
// FIXME: should we check for known functions with optional empty
// TODO: should we check for known functions with optional empty
// args so the correction dialog can do better?
if ( !static_cast<ScTokenArray*>(pArr)->Add( new FormulaMissingToken ) )
{
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 458236e..9c8f5e3 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -646,6 +646,8 @@ void ScInterpreter::ScGetDate()
{
sal_Int16 nDay = GetInt16();
sal_Int16 nMonth = GetInt16();
if (IsMissing())
SetError( errParameterExpected); // Year must be given.
sal_Int16 nYear = GetInt16();
if (nGlobalError || nYear < 0)
PushIllegalArgument();