From c3edb00e13c108cd27f20f7caf6eabb4e30ba539 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 14 Nov 2012 11:56:54 +0100 Subject: 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 --- basic/source/runtime/methods1.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'basic') 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 ) -- cgit