Skip to content

Commit

Permalink
Fix crash when importing empty ICS VCALENDAR
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarnett committed Sep 22, 2024
1 parent 82744ae commit 30b2506
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gcalcli/ics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ def get_events(

events: list[Optional[EventBody]] = []
for v in vobject.readComponents(ics):
# Strangely, in empty calendar cases vobject sometimes returns
# Components with no vevent_list attribute at all.
vevents = getattr(v, 'vevent_list', [])
events.extend(
CreateEventFromVOBJ(
ve, verbose=verbose, default_tz=default_tz, printer=printer
)
for ve in v.vevent_list
for ve in vevents
)
return events

Expand Down

0 comments on commit 30b2506

Please sign in to comment.