Bug 520705 - log error message if ics parser found no VCALENDAR component [r=philipp]
authorStefan Sitter <ssitter@gmail.com>
Sat, 27 Mar 2010 09:55:00 +0100
changeset 5289 3b38a8becffed012a0aef92c075a4233b58867d4
parent 5288 9979fbcff2c9dac63ed5d5e5b8ddb182903a3c2f
child 5290 5f5198980f402e707e946a15937ce94bc3994ac4
push idunknown
push userunknown
push dateunknown
reviewersphilipp
bugs520705
Bug 520705 - log error message if ics parser found no VCALENDAR component [r=philipp]
calendar/base/src/calIcsParser.js
--- a/calendar/base/src/calIcsParser.js
+++ b/calendar/base/src/calIcsParser.js
@@ -74,20 +74,26 @@ function ip_QueryInterface(aIID) {
 };
 
 calIcsParser.prototype.processIcalComponent =
 function ip_processIcalComponent(rootComp) {
     let calComp;
     // libical returns the vcalendar component if there is just one vcalendar.
     // If there are multiple vcalendars, it returns an xroot component, with
     // those vcalendar children. We need to handle both.
-    if (rootComp.componentType == 'VCALENDAR') {
-        calComp = rootComp;
-    } else {
-        calComp = rootComp.getFirstSubcomponent('VCALENDAR');
+    if (rootComp) {
+        if (rootComp.componentType == 'VCALENDAR') {
+            calComp = rootComp;
+        } else {
+            calComp = rootComp.getFirstSubcomponent('VCALENDAR');
+        }
+    }
+
+    if (!calComp) {
+        cal.ERROR("Parser Error. Could not find 'VCALENDAR' component in: \n" + rootComp + "\nStack: \n" + cal.STACK(10));
     }
 
     let uid2parent = {};
     let excItems = [];
     let fakedParents = {};
 
     let tzErrors = {};
     function checkTimezone(item, dt) {