diff --git a/static/js/graphing.js b/static/js/graphing.js index df1405503..b5abf2d00 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -139,6 +139,7 @@ ImageHistoryTree.prototype.setupOverscroll_ = function() { ImageHistoryTree.prototype.updateDimensions_ = function() { var container = this.container_; var dimensions = this.calculateDimensions_(container); + if (!dimensions) { return; } var m = dimensions.m; var w = dimensions.w; @@ -909,6 +910,10 @@ function FileTreeBase() { */ FileTreeBase.prototype.calculateDimensions_ = function(container) { var containerElm = document.getElementById(container); + if (!containerElm) { + return null; + } + var cw = containerElm ? containerElm.clientWidth : 1200; var barHeight = 20; var ch = (this.getNodesHeight() * barHeight) + 40; @@ -940,6 +945,7 @@ FileTreeBase.prototype.updateDimensions_ = function() { var container = this.container_; var dimensions = this.calculateDimensions_(container); + if (!dimensions) { return; } var w = dimensions.w; var h = dimensions.h; @@ -989,6 +995,7 @@ FileTreeBase.prototype.draw = function(container) { this.container_ = container; var dimensions = this.calculateDimensions_(container); + if (!dimensions) { return; } var w = dimensions.w; var h = dimensions.h; @@ -1107,6 +1114,8 @@ FileTreeBase.prototype.getVisibleCount_ = function(node) { */ FileTreeBase.prototype.getContainerHeight_ = function() { var dimensions = this.calculateDimensions_(this.container_); + if (!dimensions) { return; } + var barHeight = this.barHeight_; var height = (this.getVisibleCount_(this.root_) * (barHeight + 2)); return height + dimensions.m[0] + dimensions.m[2];