From ccf98c0c22b16ccbebd3fca9b1a20b2e8b51fed7 Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 24 Nov 2020 21:32:16 +0100 Subject: [PATCH] Surround ical parsing with try/catch to catch unknown bugs --- modules/default/calendar/calendarfetcher.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 7cb4434c..f6f84d71 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -76,7 +76,16 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn return; } - const data = ical.parseICS(requestData); + let data = []; + + try { + data = ical.parseICS(requestData); + } catch (error) { + fetchFailedCallback(self, error.message); + scheduleTimer(); + return; + } + const newEvents = []; // limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves