diff options
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r-- | plugins/itip-formatter/ChangeLog | 7 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-view.c | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog index c38d2e7694..ddaf22984b 100644 --- a/plugins/itip-formatter/ChangeLog +++ b/plugins/itip-formatter/ChangeLog @@ -1,3 +1,10 @@ +2006-08-23 Srinivasa Ragavan <sragavan@novell.com> + + ** Fix for bug #350395 by Øystein Gisnås + + * itip-view.c: (format_date_and_time_x): The patch adds some extra + checks to avoid the crash. + 2006-08-18 Chenthill Palanisamy <pchenthill@novell.com> Fixes #328268 diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index 64cb01f1ef..3d644eca93 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -150,7 +150,8 @@ format_date_and_time_x (struct tm *date_tm, /* Calculate a normalized "tomorrow" */ tomorrow_tm = *current_tm; - if (tomorrow_tm.tm_mday == time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { + /* Don't need this if date is in the past. Also, year assumption won't fail. */ + if (date_tm->tm_year >= current_tm->tm_year && tomorrow_tm.tm_mday == time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { tomorrow_tm.tm_mday = 1; if (tomorrow_tm.tm_mon == 11) { tomorrow_tm.tm_mon = 1; @@ -164,7 +165,8 @@ format_date_and_time_x (struct tm *date_tm, /* Calculate a normalized "next seven days" */ week_tm = *current_tm; - if (week_tm.tm_mday + 6 > time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { + /* Don't need this if date is in the past. Also, year assumption won't fail. */ + if (date_tm->tm_year >= current_tm->tm_year && week_tm.tm_mday + 6 > time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { week_tm.tm_mday = (week_tm.tm_mday + 6) % time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon); if (week_tm.tm_mon == 11) { week_tm.tm_mon = 1; |