summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-11-13 08:14:57 +0100
committerEike Rathke <erack@redhat.com>2018-11-13 14:14:56 +0100
commitb05470083a5a6f35a2c820500c823afadba804f0 (patch)
tree434179011db81abdc65b6f4c587ceaf82b74f9c9 /basic
parentd140157952404d061c1e9df5c133d3ace735b73f (diff)
Don't call Date's ImpYearToDays with zero year argument
...on which it asserts since 6d4f2dcc7cbba771e9d9b00de50368db4a88ef1b "Resolves: tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendar". The assert fired when executing the Basic code from attachment 146529 to <https://bugs.documentfoundation.org/show_bug.cgi?id=121337> "FileDateTime("\\nonexistent\smb\path") returns bogus result rather than throwing error": > #4 0x00007ffff1d1c830 in (anonymous namespace)::ImpYearToDays(short) (nYear=0) at tools/source/datetime/tdate.cxx:55 > #5 0x00007ffff1d1c449 in Date::DateToDays(unsigned short, unsigned short, short) (nDay=0, nMonth=0, nYear=0) at tools/source/datetime/tdate.cxx:149 > #6 0x00007ffff1d1c3e5 in Date::GetAsNormalizedDays() const (this=0x7fffffff7268) at tools/source/datetime/tdate.cxx:142 > #7 0x00007ffff1d1dae5 in operator-(Date const&, Date const&) (rDate1=1900-1-1, rDate2=0-0-0) at tools/source/datetime/tdate.cxx:581 > #8 0x00007ffff5f87347 in GetDayDiff(Date const&) (rDate=0-0-0) at basic/source/runtime/methods.cxx:4653 > #9 0x00007ffff5f8aebb in SbRtl_FileDateTime(StarBASIC*, SbxArray&, bool) (rPar=...) at basic/source/runtime/methods.cxx:3054 Change-Id: I6468eeafc3daf325d3da3dfeacd08c7df1d1a8f4 Reviewed-on: https://gerrit.libreoffice.org/63318 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 6d10a1a92edd..20348c850839 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3051,7 +3051,7 @@ void SbRtl_FileDateTime(StarBASIC *, SbxArray & rPar, bool)
aDate = Date( aDT.Day, aDT.Month, aDT.Year );
}
- double fSerial = static_cast<double>(GetDayDiff( aDate ));
+ double fSerial = aDate.IsEmpty() ? 0 : static_cast<double>(GetDayDiff( aDate ));
long nSeconds = aTime.GetHour();
nSeconds *= 3600;
nSeconds += aTime.GetMin() * 60;