Bug 520705 - log error message if ics parser found no VCALENDAR component [r=philipp]
--- 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) {