Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[515550] Break up infinite loop for small graphs
  • Loading branch information
ujhelyiz committed Apr 21, 2017
1 parent ee88577 commit bfffb4e
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -492,7 +492,15 @@ public void fitNodesWithinBounds(List<TreeNode> nodeList,
}
}

int maxCount = nodeList.size() * 100;
int totalCount = 0;
for (int i = 0; i < nodeList.size(); i++) {
// Stop this cycle if no result can be found
// Possible cause: lack of space to lay out nodes without overlapping
totalCount++;
if (totalCount > maxCount) {
break;
}
SpaceTreeNode node = (SpaceTreeNode) nodeList.get(i);
double desiredPosition = startPosition + desiredPositions[i];
moveNode(node, desiredPosition);
Expand Down

0 comments on commit bfffb4e

Please sign in to comment.