Further handle cases in the graphing library where the container element is no longer avaliable

This commit is contained in:
Joseph Schorr 2014-05-02 13:39:22 -04:00
parent 6b131fe032
commit 7fc204fe70

View file

@ -1135,7 +1135,12 @@ FileTreeBase.prototype.update_ = function(source) {
};
// Update the height of the container and the SVG.
document.getElementById(this.container_).style.height = this.getContainerHeight_() + 'px';
var containerElm = document.getElementById(this.container_);
if (!containerElm) {
return;
}
containerElm.style.height = this.getContainerHeight_() + 'px';
svg.attr('height', this.getContainerHeight_());
// Compute the flattened node list.
@ -1697,7 +1702,12 @@ LogUsageChart.prototype.handleStateChange_ = function(e) {
*/
LogUsageChart.prototype.draw = function(container, logData, startDate, endDate) {
// Reset the container's contents.
document.getElementById(container).innerHTML = '<svg></svg>';
var containerElm = document.getElementById(container);
if (!containerElm) {
return;
}
containerElm.innerHTML = '<svg></svg>';
// Returns a date offset from the given date by "days" Days.
var offsetDate = function(d, days) {