summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2010-12-03 01:18:37 (EST)
committerFabian Steeg2010-12-03 01:18:37 (EST)
commiteea63f32345a97afce2c6b8b9bf1a924f2836ce7 (patch)
treedafdc51f36b1188ffcffad1f878a45328ed8f751
parentdc33bd92fa847f4279f5d3d06b3524ef2dd4e4ee (diff)
downloadorg.eclipse.gef4-eea63f32345a97afce2c6b8b9bf1a924f2836ce7.zip
org.eclipse.gef4-eea63f32345a97afce2c6b8b9bf1a924f2836ce7.tar.gz
org.eclipse.gef4-eea63f32345a97afce2c6b8b9bf1a924f2836ce7.tar.bz2
Don't layout if the number of nodes == 0
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpringLayoutAlgorithm.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpringLayoutAlgorithm.java b/org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpringLayoutAlgorithm.java
index 7a56797..3927189 100644
--- a/org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpringLayoutAlgorithm.java
+++ b/org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpringLayoutAlgorithm.java
@@ -516,6 +516,9 @@ public class SpringLayoutAlgorithm implements LayoutAlgorithm {
* Puts vertices in random places, all between (0,0) and (1,1).
*/
public void placeRandomly() {
+ if ( locationsX.length == 0 ) {
+ return;
+ }
// If only one node in the data repository, put it in the middle
if (locationsX.length == 1) {
// If only one node in the data repository, put it in the middle