diff options
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/datefunc/datefunc.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index 392b1981bb31..d36e51d21d8b 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -466,14 +466,11 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks( sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) { - if (nMode != 0 && nMode != 1) - throw lang::IllegalArgumentException(); - if ( nMode == 0 ) { return ( nEndDate - nStartDate ) / 7; } - else + else if ( nMode == 1 ) { sal_Int32 nNullDate = GetNullDate( xOptions ); sal_Int32 nDays1 = nStartDate + nNullDate - 1; @@ -481,6 +478,8 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks( return ( std::floor( nDays2 / 7.0 ) - std::floor( nDays1 / 7.0 ) ); } + else + throw lang::IllegalArgumentException(); } /** |