gnucash master: Fix Windows crash when the TZ has no Daylight time.

John Ralls jralls at code.gnucash.org
Mon Jul 27 18:57:58 EDT 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/dd60ce69 (commit)
	from  https://github.com/Gnucash/gnucash/commit/c7f84432 (commit)



commit dd60ce6904af8d2f88f9b1563afd264fba148a92
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jul 27 22:53:03 2015 +0000

    Fix Windows crash when the TZ has no Daylight time.

diff --git a/src/libqof/qof/gnc-timezone.cpp b/src/libqof/qof/gnc-timezone.cpp
index b419604..676456e 100644
--- a/src/libqof/qof/gnc-timezone.cpp
+++ b/src/libqof/qof/gnc-timezone.cpp
@@ -154,11 +154,15 @@ zone_from_regtzi (const RegTZI& regtzi, time_zone_names names)
     dst_offsets offsets (dlt_off, start_time, end_time);
     auto std_week_num = make_week_num(regtzi.StandardDate.wDay);
     auto dlt_week_num = make_week_num(regtzi.DaylightDate.wDay);
-    ndate start (std_week_num, regtzi.StandardDate.wDayOfWeek,
-		 regtzi.StandardDate.wMonth);
-    ndate end(dlt_week_num, regtzi.DaylightDate.wDayOfWeek,
-	      regtzi.DaylightDate.wMonth);
-    calc_rule_ptr dates(new nth_day_rule (start, end));
+    calc_rule_ptr dates;
+    if (regtzi.DaylightBias != 0)
+    {
+	ndate start (std_week_num, regtzi.StandardDate.wDayOfWeek,
+		     regtzi.StandardDate.wMonth);
+	ndate end(dlt_week_num, regtzi.DaylightDate.wDayOfWeek,
+		  regtzi.DaylightDate.wMonth);
+	dates.reset(new nth_day_rule (start, end));
+    }
     return TZ_Ptr(new time_zone(names, std_off, offsets, dates));
 }
 



Summary of changes:
 src/libqof/qof/gnc-timezone.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list