diff --git a/calendar/base/content/calendar-item-editing.js b/calendar/base/content/calendar-item-editing.js index c09926f67e37..ab4f2d296858 100644 --- a/calendar/base/content/calendar-item-editing.js +++ b/calendar/base/content/calendar-item-editing.js @@ -180,6 +180,7 @@ function openEventDialog(calendarItem, calendar, mode, callback) // whether the user wants to edit all instances, or just this one. This // function prompts this question (if the item is actually an instance of a // recurring event) and returns the appropriate item that should be modified. +// Returns null if the prompt was cancelled. function getOccurrenceOrParent(occurrence) { // Check if this actually is an instance of a recurring event if (occurrence == occurrence.parentItem) { diff --git a/calendar/base/content/calendar-views.js b/calendar/base/content/calendar-views.js index a833303b5392..47c59f4ea688 100644 --- a/calendar/base/content/calendar-views.js +++ b/calendar/base/content/calendar-views.js @@ -94,6 +94,9 @@ var calendarViewController = { var itemToEdit; if (aNewStartTime && aNewEndTime) { itemToEdit = getOccurrenceOrParent(aOccurrence); + if (!itemToEdit) { + return; + } var instance = itemToEdit.clone(); // if we're about to modify the parentItem, we need to account @@ -143,6 +146,9 @@ var calendarViewController = { deleteOccurrence: function (aOccurrence) { var itemToDelete = getOccurrenceOrParent(aOccurrence); + if (!itemToDelete) { + return; + } if (!itemToDelete.parentItem.hasSameIds(itemToDelete)) { var event = itemToDelete.parentItem.clone(); event.recurrenceInfo.removeOccurrenceAt(itemToDelete.recurrenceId);