diff --git a/static/js/graphing.js b/static/js/graphing.js index 95d76d1b4..bdd821679 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -101,6 +101,10 @@ ImageHistoryTree.prototype.draw = function(container) { return html; } + if (!d.image) { + return '(This repository is empty)'; + } + if (d.image.comment) { html += '' + formatComment(d.image.comment) + ''; } @@ -198,7 +202,7 @@ ImageHistoryTree.prototype.buildRoot_ = function() { // "name": "...", // "children": [...] // } - var formatted = {}; + var formatted = {"name": "No images found"}; // Build a node for each image. var imageByDBID = {}; @@ -266,8 +270,10 @@ ImageHistoryTree.prototype.buildRoot_ = function() { */ ImageHistoryTree.prototype.determineMaximumHeight_ = function(node) { var maxHeight = 0; - for (var i = 0; i < node.children.length; ++i) { - maxHeight = Math.max(this.determineMaximumHeight_(node.children[i]), maxHeight); + if (node.children) { + for (var i = 0; i < node.children.length; ++i) { + maxHeight = Math.max(this.determineMaximumHeight_(node.children[i]), maxHeight); + } } return maxHeight + 1; }; @@ -476,7 +482,7 @@ ImageHistoryTree.prototype.update_ = function(source) { .attr("dy", ".35em") .attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; }) .text(function(d) { return d.name; }) - .on("click", function(d) { that.changeImage_(d.image.id); }) + .on("click", function(d) { if (d.image) { that.changeImage_(d.image.id); } }) .on('mouseover', tip.show) .on('mouseout', tip.hide);