summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2015-02-11 09:32:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-02-17 13:16:30 +0000
commit0eddb0e202dc1926757624ea77e99944ecd02221 (patch)
tree603af20212ba975da78c7399a34ca73384fd4a16
parentc0a23858f8eb94c585b3b33218d8e2aaceec0a03 (diff)
tdf#88576 fix handling of empty arguments in IF(), IFERROR() and IFNA()
Reviewed-on: https://gerrit.libreoffice.org/14415 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 0b75eda1090f92adc678ceff2565da2dc7d9328c) tdf#88576 check that two parameters are given for IFERROR() and IFNA() Otherwise the functions failed only for the error case resulting in #NULL! error. (cherry picked from commit 6583f4e30015164af4972921b5bb7880dfb65f65) eb987637698ab418fc0a60cd873e23878c9f497b Change-Id: I8acca26cf7398768a9e25f97f3a9e61754ab2179 Reviewed-on: https://gerrit.libreoffice.org/14422 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/tool/interpr1.cxx6
-rw-r--r--sc/source/core/tool/interpr4.cxx5
2 files changed, 8 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f01137a45216..c5b1f02111f6 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -237,9 +237,11 @@ void ScInterpreter::ScIfError( bool bNAonly )
{
const short* pJump = pCur->GetJump();
short nJumpCount = pJump[ 0 ];
- if (!sp)
+ if (!sp || nJumpCount != 2)
{
- PushError( errUnknownStackVariable);
+ // Reset nGlobalError here to not propagate the old error, if any.
+ nGlobalError = (sp ? errParameterExpected : errUnknownStackVariable);
+ PushError( nGlobalError);
aCode.Jump( pJump[ nJumpCount ], pJump[ nJumpCount ] );
return;
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2b2dd651f2e6..bbb77ca0c9ca 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3025,7 +3025,10 @@ void ScInterpreter::ScExternal()
void ScInterpreter::ScMissing()
{
- PushTempToken( new FormulaMissingToken );
+ if ( aCode.IsEndOfPath() )
+ PushTempToken( new ScEmptyCellToken( false, false ) );
+ else
+ PushTempToken( new FormulaMissingToken );
}
#if HAVE_FEATURE_SCRIPTING