diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-12-04 14:16:49 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-12-04 15:00:07 +0100 |
commit | fb37997ece889d9a90bb5de600fcb763d339734c (patch) | |
tree | fc1decf41434d2f70ad5d8579c3bc94e9a39553e /scaddins | |
parent | 4539ffe350ebe28ff6d0f5cd4a6c3d45c1424fba (diff) |
Small refactor
Change-Id: I9487c32a1482da24e7b656141b116e7c5ca6d2dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126297
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
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(); } /** |