Fix timezone constructor crash when zone file has no transitions.

This commit is contained in:
John Ralls 2017-12-18 09:48:17 -08:00
parent 0026b10851
commit 5af21dfad8

View File

@ -677,8 +677,9 @@ TimeZoneProvider::parse_file(const std::string& tzname)
/* if the transitions end before the end of the zoneinfo coverage /* if the transitions end before the end of the zoneinfo coverage
* period then the zone rescinded DST and we need a final no-dstzone. * period then the zone rescinded DST and we need a final no-dstzone.
*/ */
if (last_time.is_not_a_date_time() || if (last_time.is_not_a_date_time())
last_time.date().year() < parser.last_year) zone_vector.push_back(zone_no_dst(max_year, last_info));
else if (last_time.date().year() < parser.last_year)
zone_vector.push_back(zone_no_dst(last_time.date().year(), last_info)); zone_vector.push_back(zone_no_dst(last_time.date().year(), last_info));
} }