diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-11-14 11:56:54 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-14 13:32:27 +0100 |
commit | c3edb00e13c108cd27f20f7caf6eabb4e30ba539 (patch) | |
tree | 8b0cbaf61fd79393f6f5ae220ab0293fc9c8a092 | |
parent | 3dee92e135ea71e9ee448a43dbf879d62e38f1ec (diff) |
Report errors for invalid DateAdd/Diff/Part Add parameter values
...so that e.g.,
DateAdd("x", 1, "1/31/2004")
(where "x" is not in the list of valid values for the Add parameter, "yyyy",
"q", "m", etc.) leads to a Basic runtime error rather than going into a
seemingly endless while(nNewMonth>nTargetMonth) loop at the end of
RTLFUNC(DateAdd) (basic/source/runtime/methods.cxx).
Change-Id: I15c3bdb62723ffddf36ff2396ffb294369d93ff8
-rw-r--r-- | basic/source/runtime/methods1.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index e12a69f0e94a..b9f83b76a025 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -2013,17 +2013,17 @@ static IntervalInfo pIntervalTable[] = IntervalInfo* getIntervalInfo( const OUString& rStringCode ) { - IntervalInfo* pInfo = NULL; + IntervalInfo* pInfo; sal_Int16 i = 0; while( !(pInfo = pIntervalTable + i)->mStringCode.isEmpty() ) { if( rStringCode.equalsIgnoreAsciiCase( pInfo->mStringCode ) ) { - break; + return pInfo; } i++; } - return pInfo; + return NULL; } inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int16& rnDay, double dDate ) |