scaddins/source/analysis/financial.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 67188d0e552c9dc50905f7f693d2bb24751a11c5
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Jun 22 17:42:22 2016 +0200

    tdf#100528 Add constraints for AMORLINC function
    
    Function returned different results than Excel does because of missing 
constraints.
    Added constraints are all defined in ODFF1.2 for AMORLINC.
    
    Change-Id: Icd5f9de9cf252e6864e3aa9b47346f6f75669c92
    Reviewed-on: https://gerrit.libreoffice.org/26572
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/scaddins/source/analysis/financial.cxx 
b/scaddins/source/analysis/financial.cxx
index 8ad0ebb..052f8b5 100644
--- a/scaddins/source/analysis/financial.cxx
+++ b/scaddins/source/analysis/financial.cxx
@@ -40,7 +40,8 @@ double SAL_CALL AnalysisAddIn::getAmorlinc( const 
css::uno::Reference< css::bean
     double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal,
     double fPer, double fRate, const css::uno::Any& rOB ) throw( 
css::uno::RuntimeException, css::lang::IllegalArgumentException, std::exception 
)
 {
-    if( nDate > nFirstPer || fRate <= 0.0 || fRestVal > fCost )
+    if ( nDate > nFirstPer || fRate <= 0.0 || fRestVal > fCost ||
+         fCost <= 0.0 || fRestVal < 0 || fPer < 0 )
         throw css::lang::IllegalArgumentException();
 
     double fRet = GetAmorlinc( GetNullDate( xOpt ), fCost, nDate, nFirstPer, 
fRestVal, fPer, fRate, getDateMode( xOpt, rOB ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to