Avoid some potential error conditions with missing state stuff

This commit is contained in:
Nathan Gray 2015-12-08 00:22:50 +00:00
parent 20e23b811e
commit 864a5f2673
2 changed files with 8 additions and 2 deletions

View File

@ -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;
}
}
}

View File

@ -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;