From a57fcad270dd9938c6eda6c4b48f06d78fd19bb3 Mon Sep 17 00:00:00 2001
From: Peter Bieringer <pb@bieringer.de>
Date: Sat, 17 Sep 2016 13:56:27 +0200
Subject: [PATCH] catch 2nd case for broken object

---
 radicale/storage.py  | 9 +++++++--
 radicale/xmlutils.py | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/radicale/storage.py b/radicale/storage.py
index 2d60c58..9ac01fe 100644
--- a/radicale/storage.py
+++ b/radicale/storage.py
@@ -635,7 +635,12 @@ class Collection(BaseCollection):
         last_modified = time.strftime(
             "%a, %d %b %Y %H:%M:%S GMT",
             time.gmtime(os.path.getmtime(path)))
-        return Item(self, vobject.readOne(text), href, last_modified)
+        try:
+            item = Item(self, vobject.readOne(text), href, last_modified)
+        except:
+            self.logger.error("Object broken (skip 'get'): %s", path)
+            return None;
+        return item;
 
     def has(self, href):
         return self.get(href) is not None
@@ -712,7 +717,7 @@ class Collection(BaseCollection):
                     try:
                         items.append(vobject.readOne(fd.read()))
                     except:
-                        self.logger.error("Object broken (skip): %s", path)
+                        self.logger.error("Object broken (skip 'list'): %s", path)
         time_end = datetime.datetime.now()
         self.logger.info("Collection read %d items in %s sec from %s", len(items),(time_end - time_begin).total_seconds(), self._filesystem_path)
         if self.get_meta("tag") == "VCALENDAR":
diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py
index a75a441..1c2a428 100644
--- a/radicale/xmlutils.py
+++ b/radicale/xmlutils.py
@@ -796,6 +796,8 @@ def report(path, xml_request, collection):
             items = collection.pre_filtered_list(filters)
 
         for item in items:
+            if not item:
+                continue
             if filters:
                 match = (
                     _comp_match if collection.get_meta("tag") == "VCALENDAR"