]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Fix list indexing error in updateFixedLengths. 41/3941/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Fri, 28 Feb 2020 07:57:06 +0000 (09:57 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Fri, 28 Feb 2020 07:57:51 +0000 (09:57 +0200)
gitlab #94

Change-Id: I70402e5ca920b44bfc0fa0647429c12595cca08b

org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java

index 8864ffd8cc8cda8fde18258fc756404d9a9066ec..542534c3eebf983af835d4deefc7d735f70a5ee4 100644 (file)
@@ -761,7 +761,7 @@ public class PipingRules {
                    double curr = gapObj.d;
                    int d = 1;
                    while (d < gaps.size() && curr < -MIN_INLINE_LENGTH) {
-                       GapObj next = i+d >= 0 ? gaps.get(i+d) : null;
+                       GapObj next = i+d < gaps.size() ? gaps.get(i+d) : null;
                     GapObj prev = i-d >= 0 ? gaps.get(i-d) : null;
                        if (next != null && next.gap == Gap.SPACE) {
                            double move = Math.min(-curr, next.d);