sc/source/core/tool/interpr8.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
New commits: commit e43e2886effea42658f4bc3b69f46cc70c9251e0 Author: Winfried Donkers <[email protected]> Date: Fri Jul 29 09:16:34 2016 +0200 tdf#97831 follow up : remove unused arguments from stack Intention: Make e.g. [1+SWITCH(1;1;1;6)] work. Without this fix, the result is 7 but should be 2. Reviewed-on: https://gerrit.libreoffice.org/27664 Tested-by: Jenkins <[email protected]> Reviewed-by: Eike Rathke <[email protected]> Tested-by: Eike Rathke <[email protected]> (cherry picked from commit 3ee2cae3a36e5d052e02c3f7b226dc3b79bd2ebc) Conflicts: sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods Change-Id: I2a72e458e5458c02c3ce2f4214b86ba13f7b1d11 Reviewed-on: https://gerrit.libreoffice.org/27697 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Eike Rathke <[email protected]> Tested-by: Jenkins <[email protected]> diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index b62fb59..972b125 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -1897,7 +1897,15 @@ void ScInterpreter::ScIfs_MS() //push result : FormulaTokenRef xToken( PopToken() ); if ( xToken ) + { + // Remove unused arguments of IFS from the stack before pushing the result. + while ( nParamCount > 1 ) + { + Pop(); + nParamCount--; + } PushTempToken( xToken.get() ); + } else PushError( errUnknownStackVariable ); } @@ -2000,7 +2008,15 @@ void ScInterpreter::ScSwitch_MS() // push result FormulaTokenRef xToken( PopToken() ); if ( xToken ) + { + // Remove unused arguments of SWITCH from the stack before pushing the result. + while ( nParamCount > 1 ) + { + Pop(); + nParamCount--; + } PushTempToken( xToken.get() ); + } else PushError( errUnknownStackVariable ); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
