diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-09-05 18:00:34 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-09-05 18:00:34 -0500 |
commit | f35c8eb35f88ef43e71395445067d30cd3a48c72 (patch) | |
tree | 6cc9453addb7e1c5d92320ea36dcaaecc80cae07 /src/service.c | |
parent | a7d1945d1988bc0b85e83f903191c6ee125a97af (diff) | |
download | ayatana-indicator-datetime-f35c8eb35f88ef43e71395445067d30cd3a48c72.tar.gz ayatana-indicator-datetime-f35c8eb35f88ef43e71395445067d30cd3a48c72.tar.bz2 ayatana-indicator-datetime-f35c8eb35f88ef43e71395445067d30cd3a48c72.zip |
in update_appointment_lists(), safeguard against NULL GDateTimes.
Diffstat (limited to 'src/service.c')
-rw-r--r-- | src/service.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/service.c b/src/service.c index ce99c59..c46beeb 100644 --- a/src/service.c +++ b/src/service.c @@ -1652,22 +1652,23 @@ update_appointment_lists (IndicatorDatetimeService * self) g_date_time_get_ymd (calendar_date, &y, &m, &d); begin = g_date_time_new_local (y, m, 1, 0, 0, 0); end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 0); - indicator_datetime_planner_get_appointments (planner, begin, end, - on_calendar_appointments_ready, - self); - g_date_time_unref (begin); - g_date_time_unref (end); + if (begin && end) + indicator_datetime_planner_get_appointments (planner, begin, end, + on_calendar_appointments_ready, + self); + g_clear_pointer (&begin, g_date_time_unref); + g_clear_pointer (&end, g_date_time_unref); /* get the upcoming appointments */ begin = g_date_time_ref (calendar_date); end = g_date_time_add_months (begin, 1); - indicator_datetime_planner_get_appointments (planner, begin, end, - on_upcoming_appointments_ready, - self); - g_date_time_unref (begin); - g_date_time_unref (end); - - g_date_time_unref (calendar_date); + if (begin && end) + indicator_datetime_planner_get_appointments (planner, begin, end, + on_upcoming_appointments_ready, + self); + g_clear_pointer (&begin, g_date_time_unref); + g_clear_pointer (&end, g_date_time_unref); + g_clear_pointer (&calendar_date, g_date_time_unref); } |