From ce4004da0f0df668374af494288f9f05f7ca0b26 Mon Sep 17 00:00:00 2001 From: Eugene Katkov Date: Thu, 5 Oct 2023 15:48:05 +0400 Subject: [PATCH] Fixed object_by_uid() method. Checks if the event has the icalendar_component attribute --- caldav/objects.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/caldav/objects.py b/caldav/objects.py index 74626931..72dbd702 100644 --- a/caldav/objects.py +++ b/caldav/objects.py @@ -1470,9 +1470,10 @@ def object_by_uid(self, uid, comp_filter=None, comp_class=None): ## but at one point it broke due to an extra CR in the data. ## Usage of the icalendar library increases readability and ## reliability - item_uid = item.icalendar_component.get("UID", None) - if item_uid and item_uid == uid: - items_found2.append(item) + if item.icalendar_component: + item_uid = item.icalendar_component.get("UID", None) + if item_uid and item_uid == uid: + items_found2.append(item) if not items_found2: raise error.NotFoundError("%s not found on server" % uid) error.assert_(len(items_found2) == 1)