fix: 🐛 fix a rare crash on EVENTS_CACHE
All checks were successful
divent / lint (push) Successful in 1m45s
divent / docker (push) Successful in 1m29s
divent / pypi (push) Has been skipped

This commit is contained in:
Michel Roux 2025-01-07 08:34:41 +01:00
parent 38ed428d8a
commit 2b046afec8

View File

@ -332,7 +332,10 @@ async def ical(entity_id: str):
for guild in client.guilds:
for scheduled_event in guild.scheduled_events:
if user.id in EVENTS_CACHE[scheduled_event.id]:
if (
scheduled_event.id in EVENTS_CACHE
and user.id in EVENTS_CACHE[scheduled_event.id]
):
event = make_event(scheduled_event)
calendar.events.append(event)