summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-11-14 11:56:54 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-11-14 13:32:27 +0100
commitc3edb00e13c108cd27f20f7caf6eabb4e30ba539 (patch)
tree8b0cbaf61fd79393f6f5ae220ab0293fc9c8a092 /basic
parent3dee92e135ea71e9ee448a43dbf879d62e38f1ec (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
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods1.cxx6
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 )