Bug 735253 - JavaScript Error: "TypeError: calendar is null" {file: "chrome://calendar/content/calendar-task-editing.js" line: 102}. r/a=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Tue, 19 May 2015 14:37:10 +0200
changeset 26041 a6b8669b874611915bd10d7ef484ca71ee1b2ac1
parent 26040 36189f77dfe989e3ba209d7eed2dac5e8b2bceea
child 26045 854d2b3102553cf4408376f248b1ffd7b538ca5c
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs735253
Bug 735253 - JavaScript Error: "TypeError: calendar is null" {file: "chrome://calendar/content/calendar-task-editing.js" line: 102}. r/a=philipp
calendar/base/content/calendar-task-editing.js
--- a/calendar/base/content/calendar-task-editing.js
+++ b/calendar/base/content/calendar-task-editing.js
@@ -84,25 +84,29 @@ var taskEdit = {
     },
 
     /**
      * Handler function to call when the quick-add textbox loses focus.
      *
      * @param aEvent    The DOM blur event
      */
     onBlur: function tE_onBlur(aEvent) {
-        var edit = aEvent.target;
+        let edit = aEvent.target;
         if (edit.localName == "input") {
             // For some reason, we only receive the blur event for the input
             // element. There are no targets that point to the textbox. Go up
             // the parent chain until we reach the textbox.
             edit = edit.parentNode.parentNode;
         }
 
-        var calendar = getSelectedCalendar();
+        let calendar = getSelectedCalendar();
+        if (!calendar) {
+            // this must be a first run, we don't have a calendar yet
+            return;
+        }
 
         if (calendar.getProperty("capabilities.tasks.supported") === false){
             taskEdit.setupTaskField(edit,
                                     true,
                                     calGetString("calendar", "taskEditInstructionsCapability"));
         } else if (!isCalendarWritable(calendar)) {
             taskEdit.setupTaskField(edit,
                                     true,