From 864a5f2673a84675f8acb3bcd3853da068f06a9c Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 8 Dec 2015 00:22:50 +0000 Subject: [PATCH] Avoid some potential error conditions with missing state stuff --- calendar/js/app.js | 5 ++++- calendar/js/et2_widget_timegrid.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index 25d83d3b76..a491622859 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -1680,7 +1680,7 @@ app.classes.calendar = AppJS.extend( this.state_update_in_progress = true; // Sanitize owner so it's always an array - if(state.state.owner === null) + if(state.state.owner === null || !state.state.owner) { state.state.owner = undefined; } @@ -2387,8 +2387,11 @@ app.classes.calendar = AppJS.extend( } } + var in_progress = app.calendar.state_update_in_progress; + app.calendar.state_update_in_progress = true; widget.set_select_options(widget.options.select_options); widget.set_value(widget.getValue()); + app.calendar.state_update_in_progress = in_progress; } } } diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index ac0e0c4c1c..8bb1ef7bce 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -693,7 +693,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz this.scrolling.append(this.days); // If day list is still empty, recalculate it from start & end date - if(this.day_list.length === 0) + if(this.day_list.length === 0 && this.options.start_date && this.options.end_date) { this.day_list = this._calculate_day_list(this.options.start_date, this.options.end_date, this.options.show_weekend); } @@ -1326,6 +1326,9 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz */ set_granularity: function(minutes) { + // Avoid 0 or less + minutes = Math.max(1,minutes); + if(this.options.granularity != minutes) { this.options.granularity = minutes;