mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix misplaced try block that caused unhandled exception if year out of range.
This commit is contained in:
parent
5389aa22ab
commit
5708707f6c
@ -158,12 +158,16 @@ LDT_from_unix_local(const time64 time)
|
|||||||
static LDT
|
static LDT
|
||||||
LDT_from_struct_tm(const struct tm tm)
|
LDT_from_struct_tm(const struct tm tm)
|
||||||
{
|
{
|
||||||
auto tdate = boost::gregorian::date_from_tm(tm);
|
Date tdate;
|
||||||
auto tdur = boost::posix_time::time_duration(tm.tm_hour, tm.tm_min,
|
Duration tdur;
|
||||||
tm.tm_sec, 0);
|
TZ_Ptr tz;
|
||||||
auto tz = tzp.get(tdate.year());
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
tdate = boost::gregorian::date_from_tm(tm);
|
||||||
|
tdur = boost::posix_time::time_duration(tm.tm_hour, tm.tm_min,
|
||||||
|
tm.tm_sec, 0);
|
||||||
|
tz = tzp.get(tdate.year());
|
||||||
LDT ldt(tdate, tdur, tz, LDTBase::EXCEPTION_ON_ERROR);
|
LDT ldt(tdate, tdur, tz, LDTBase::EXCEPTION_ON_ERROR);
|
||||||
return ldt;
|
return ldt;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user