aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-09-05 18:00:34 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-09-05 18:00:34 -0500
commitf35c8eb35f88ef43e71395445067d30cd3a48c72 (patch)
tree6cc9453addb7e1c5d92320ea36dcaaecc80cae07 /src/service.c
parenta7d1945d1988bc0b85e83f903191c6ee125a97af (diff)
downloadayatana-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.c25
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);
}