From 19307b54bc826cebbdea8cd7e1cdd8499bc1076f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 29 Jun 2011 23:08:37 +0200 Subject: Add a bit more error checking and do not leak icalcomponent-s --- modules/calendar/e-cal-shell-backend.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'modules/calendar/e-cal-shell-backend.c') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 8d0c6ef36a..4b2692e420 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -624,10 +624,14 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomp); + if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { + g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC); + icalcomponent_free (icalcomp); + icalcomp = NULL; + } - icalprop = icalcomponent_get_first_property ( - icalcomp, ICAL_ATTENDEE_PROPERTY); + icalprop = icalcomp ? icalcomponent_get_first_property ( + icalcomp, ICAL_ATTENDEE_PROPERTY) : NULL; if (icalprop != NULL) flags |= COMP_EDITOR_MEETING; -- cgit