Fixed #141 list index out of range

If the number of events exceeded the number of lines allocated for events, a *list index out of range* exception was thrown. This has been fixed now  by providing an additional check.
This commit is contained in:
Ace 2020-11-22 13:27:27 +01:00
parent 9517b303b4
commit 948573cb59

View File

@ -297,9 +297,11 @@ class Calendar(inkycal_module):
cursor = 0
for event in upcoming_events:
if cursor < len(event_lines):
name = event['title']
date = event['begin'].format(self.date_format, locale=lang)
time = event['begin'].format(self.time_format, locale=lang)
#logger.debug(f"name:{name} date:{date} time:{time}")
if now < event['end']:
write(im_colour, event_lines[cursor], (date_width, line_height),