From 7fc204fe704c10e6aa9a3426a6c520bcd10c644a Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 2 May 2014 13:39:22 -0400 Subject: [PATCH] Further handle cases in the graphing library where the container element is no longer avaliable --- static/js/graphing.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/static/js/graphing.js b/static/js/graphing.js index e5306c487..df1405503 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -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 = ''; + var containerElm = document.getElementById(container); + if (!containerElm) { + return; + } + + containerElm.innerHTML = ''; // Returns a date offset from the given date by "days" Days. var offsetDate = function(d, days) {