From bde8ce214f302991cd644e6b4d6c9bc786d91264 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 15 Jan 2022 17:01:36 +0100 Subject: [PATCH] [calendar] fix .ics --- src/calendar/helpers.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calendar/helpers.js b/src/calendar/helpers.js index 880229e8..d313ef37 100644 --- a/src/calendar/helpers.js +++ b/src/calendar/helpers.js @@ -78,6 +78,12 @@ module.exports.Event = class { getDays(year) { year = parseInt(year); + + if (this.daysMemoise === undefined) { + // shouldn't happen, but somehow does, but only on prod? + this.daysMemoise = {}; + } + if (this.daysMemoise[year] === undefined) { this.daysMemoise[year] = [...this.generator(iterateMonth(year, this.month))]; } @@ -111,6 +117,9 @@ module.exports.Event = class { toIcs(year, translations, clearLinkedText, sequence = 1) { const days = this.getDays(year); + if (!days.length) { + return null; + } const first = days[0]; const last = days[days.length - 1].next();