Initialize icaltimetype variables in Vcalendar's feed_fetch().
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 13 Mar 2017 18:03:25 +0000 (19:03 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Mon, 13 Mar 2017 18:03:25 +0000 (19:03 +0100)
Also print out debug output if an event has no start or end,
as it can help determine why a malformed event file shows
weird times or duration.

src/plugins/vcalendar/vcal_folder.c

index 7951ab7dbd1e192e3e2ea09cf03dc5e7eb242f37..97e7ded8de2b6d545a14a8a4362ce9ba04d0e4ec 100644 (file)
@@ -610,7 +610,8 @@ add_new:
                        }
                        if (rprop && ritr) {
                                struct icaldurationtype ical_dur;
                        }
                        if (rprop && ritr) {
                                struct icaldurationtype ical_dur;
-                               struct icaltimetype dtstart, dtend;
+                               struct icaltimetype dtstart = icaltime_null_time();
+                               struct icaltimetype dtend = icaltime_null_time();
                                evt = icalcomponent_new_clone(evt);
                                prop = icalcomponent_get_first_property(evt, ICAL_RRULE_PROPERTY);
                                if (prop) {
                                evt = icalcomponent_new_clone(evt);
                                prop = icalcomponent_get_first_property(evt, ICAL_RRULE_PROPERTY);
                                if (prop) {
@@ -620,9 +621,13 @@ add_new:
                                prop = icalcomponent_get_first_property(evt, ICAL_DTSTART_PROPERTY);
                                if (prop)
                                        dtstart = icalproperty_get_dtstart(prop);
                                prop = icalcomponent_get_first_property(evt, ICAL_DTSTART_PROPERTY);
                                if (prop)
                                        dtstart = icalproperty_get_dtstart(prop);
+                               else
+                                       debug_print("event has no DTSTART!\n");
                                prop = icalcomponent_get_first_property(evt, ICAL_DTEND_PROPERTY);
                                if (prop)
                                        dtend = icalproperty_get_dtend(prop);
                                prop = icalcomponent_get_first_property(evt, ICAL_DTEND_PROPERTY);
                                if (prop)
                                        dtend = icalproperty_get_dtend(prop);
+                               else
+                                       debug_print("event has no DTEND!\n");
                                ical_dur = icaltime_subtract(dtend, dtstart);
                                next = icalrecur_iterator_next(ritr);
                                if (!icaltime_is_null_time(next) &&
                                ical_dur = icaltime_subtract(dtend, dtstart);
                                next = icalrecur_iterator_next(ritr);
                                if (!icaltime_is_null_time(next) &&