Related: tdf#111675 Replace Pop() with PopError() where relevant

... to propagate the original (previous) error instead of
overriding it with a new error. Pop() may only be used if the
stack type is already known to be not svError, or to explicitly
ignore a current error.

Change-Id: I5a980c29f2d2679c0e2f2fc7e53c458dc147911f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131404
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f85c219..f80deb1 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2828,7 +2828,7 @@ void ScInterpreter::ScFormula()
        }
        break;
        default:
            Pop();
            PopError();
            SetError( FormulaError::NotAvailable );
    }
    PushString( aFormula );
@@ -3733,7 +3733,7 @@ void ScInterpreter::ScMin( bool bTextAsZero )
            }
            break;
            default :
                Pop();
                PopError();
                SetError(FormulaError::IllegalParameter);
        }
    }
@@ -3891,7 +3891,7 @@ void ScInterpreter::ScMax( bool bTextAsZero )
            }
            break;
            default :
                Pop();
                PopError();
                SetError(FormulaError::IllegalParameter);
        }
    }
@@ -4102,7 +4102,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double
            }
            break;
            default :
                Pop();
                PopError();
                SetError(FormulaError::IllegalParameter);
        }
    }
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 185ad83..11353a6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2702,7 +2702,7 @@ void ScInterpreter::ScExternal()
        else
        {
            while( nParamCount-- > 0)
                Pop();
                PopError();
            PushIllegalParameter();
        }
    }
@@ -3078,7 +3078,7 @@ void ScInterpreter::ScExternal()
    {
        while( nParamCount-- > 0)
        {
            Pop();
            PopError();
        }
        PushError( FormulaError::NoAddin );
    }
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index dbeab67..9dd4426 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -515,7 +515,7 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
                            else
                            {
                                while (nParamCount-- > 0)
                                    Pop();
                                    PopError();
                                SetError( FormulaError::NoValue );
                            }
                        }