Make the image history tree more resistant to odd structures
This commit is contained in:
parent
4dff6557ae
commit
407bd0cd72
1 changed files with 8 additions and 3 deletions
|
@ -568,7 +568,10 @@ ImageHistoryTree.prototype.collapseNodes_ = function(node) {
|
|||
var current = node;
|
||||
var previous = node;
|
||||
var encountered = [];
|
||||
while (current.children.length == 1 && current.tags.length == 0) {
|
||||
while (current.children
|
||||
&& current.children.length == 1
|
||||
&& curren.tags
|
||||
&& current.tags.length == 0) {
|
||||
encountered.push(current);
|
||||
previous = current;
|
||||
current = current.children[0];
|
||||
|
@ -591,8 +594,10 @@ ImageHistoryTree.prototype.collapseNodes_ = function(node) {
|
|||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < node.children.length; ++i) {
|
||||
this.collapseNodes_(node.children[i]);
|
||||
if (node.children) {
|
||||
for (var i = 0; i < node.children.length; ++i) {
|
||||
this.collapseNodes_(node.children[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue