diff options
author | Eike Rathke <erack@redhat.com> | 2016-05-06 21:52:28 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-05-07 01:07:19 +0200 |
commit | c54f6161480fc3721bf8e208cd12a7446ab608b7 (patch) | |
tree | 8363af29e46ec36c7082ddcd3c9fb919f96d8335 /sc | |
parent | 0ed8a6a5bbe31c9713d017594fbbcf38618e8c1d (diff) |
coverity#1359230 DEADCODE, detect missing parameter, tdf#97831 follow-up
... so SWITCH with less than 3 parameters returns the proper error code
instead of #N/A.
Change-Id: Ib5d696a640f7084ca46c3cf8f378ea6e659e3f11
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr8.cxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index 1b7bf6d5380f..36304d8849aa 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -1913,6 +1913,9 @@ void ScInterpreter::ScSwitch_MS() { short nParamCount = GetByte(); + if (!MustHaveParamCountMin( nParamCount, 3)) + return; + ReverseStack( nParamCount ); nGlobalError = 0; // propagate only for match or active result path @@ -1970,13 +1973,6 @@ void ScInterpreter::ScSwitch_MS() ( !isValue && aRefStr.getDataIgnoreCase() == aStr.getDataIgnoreCase() )) ) { // TRUE - if ( nParamCount < 1 ) - { - // no parameter given for THEN - nGlobalError = nFirstMatchError; - PushParameterExpected(); - return; - } bFinished = true; } else |