Index: /applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/LaneGui.java
===================================================================
--- /applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/LaneGui.java	(revision 26315)
+++ /applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/LaneGui.java	(revision 26316)
@@ -2,4 +2,5 @@
 
 import static java.lang.Math.max;
+import static java.lang.Math.min;
 import static org.openstreetmap.josm.plugins.turnlanes.gui.GuiUtil.area;
 
@@ -88,8 +89,9 @@
             final double newLength = getModel().getOutgoingRoadEnd().isFromEnd() ? offset : getRoad().getLength()
                     - offset;
-            
-            length = newLength;
-            if (updateModel && newLength > 0) {
-                getModel().setLength(newLength * getRoad().getContainer().getMpp());
+            final double adjustedLength = min(max(newLength, 0.1), getRoad().getLength());
+            
+            length = adjustedLength;
+            if (updateModel) {
+                getModel().setLength(adjustedLength * getRoad().getContainer().getMpp());
             }
             
@@ -326,19 +328,19 @@
             
             outer = inner.offset(W, SL, SL + AL, 0);
-            area(area, inner.subpath(0, L), outer.subpath(0, L + WW));
-            
-            lengthSlider.move(inner.getPoint(L));
+            area(area, inner.subpath(0, L, true), outer.subpath(0, L + WW, true));
+            
+            lengthSlider.move(inner.getPoint(L, true));
             
             if (L > leftLength) {
-                innerLine.append(inner.subpath(max(0, leftLength + WW), L).getIterator(), leftLength >= 0
+                innerLine.append(inner.subpath(leftLength + WW, L, true).getIterator(), leftLength >= 0
                         || getModel().getOutgoingRoadEnd().isFromEnd());
-                final Point2D op = outer.getPoint(L + WW);
+                final Point2D op = outer.getPoint(L + WW, true);
                 innerLine.lineTo(op.getX(), op.getY());
             }
         } else if (getModel().getKind() == Lane.Kind.EXTRA_RIGHT) {
             outer = inner.offset(W, L, L + WW, 0);
-            area(area, inner.subpath(0, L + WW), outer.subpath(0, L));
-            
-            lengthSlider.move(outer.getPoint(L));
+            area(area, inner.subpath(0, L + WW, true), outer.subpath(0, L, true));
+            
+            lengthSlider.move(outer.getPoint(L, true));
         } else {
             outer = inner.offset(W, -1, -1, W);
@@ -346,5 +348,5 @@
             
             if (leftLength < L) {
-                innerLine.append(inner.subpath(max(0, leftLength + WW), L).getIterator(), leftLength >= 0
+                innerLine.append(inner.subpath(leftLength + WW, L, true).getIterator(), leftLength >= 0
                         || getModel().getOutgoingRoadEnd().isFromEnd());
             }
Index: /applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/Path.java
===================================================================
--- /applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/Path.java	(revision 26315)
+++ /applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/Path.java	(revision 26316)
@@ -209,6 +209,6 @@
         @Override
         public SimplePathIterator getIterator() {
-            return new SimplePathIterator(previous.getIteratorInternal(angle), PathIterator.SEG_LINETO, endX, endY, 0, 0, 0,
-                0);
+            return new SimplePathIterator(previous.getIteratorInternal(angle), PathIterator.SEG_LINETO, endX, endY, 0,
+                    0, 0, 0);
         }
         
@@ -217,4 +217,10 @@
             final double PL = previous.getLength();
             final double ML = PL + length;
+            
+            if (from > ML) {
+                throw new IllegalArgumentException("from > length");
+            } else if (to > ML) {
+                throw new IllegalArgumentException("to > length");
+            }
             
             if (to < PL) {
@@ -229,5 +235,5 @@
                 return new Line(new Start(start.getX(), start.getY(), angle), end.getX(), end.getY(), EL - from);
             } else {
-                return new Line(previous.subpath(from, to), end.getX(), end.getY(), EL - PL);
+                return new Line(previous.subpath(from, PL), end.getX(), end.getY(), EL - PL);
             }
         }
@@ -237,4 +243,8 @@
             final double PL = previous.getLength();
             final double ML = PL + length;
+            
+            if (offset > ML) {
+                throw new IllegalArgumentException("offset > length");
+            }
             
             if (offset <= ML && offset >= PL) {
@@ -376,5 +386,6 @@
                 final double w2 = we - (m2 - ML) * (we - ws) / (m2 - m1);
                 
-                return new Curve(prev, fromRadius - s * w1, toRadius - s * w2, offsetAngle(prev, angle), length, fromAngle);
+                return new Curve(prev, fromRadius - s * w1, toRadius - s * w2, offsetAngle(prev, angle), length,
+                        fromAngle);
             }
         }
@@ -408,4 +419,10 @@
             final double ML = PL + length;
             
+            if (from > ML) {
+                throw new IllegalArgumentException("from > length");
+            } else if (to > ML) {
+                throw new IllegalArgumentException("to > length");
+            }
+            
             if (to < PL) {
                 return previous.subpath(from, to);
@@ -427,5 +444,5 @@
                 return new Curve(new Start(start.getX(), start.getY(), fa), fromR, toR, a, l, fa);
             } else {
-                return new Curve(previous.subpath(from, to), fromR, toR, a, l, fromAngle);
+                return new Curve(previous.subpath(from, PL), fromR, toR, a, l, fromAngle);
             }
         }
@@ -457,5 +474,5 @@
             
             return new SimplePathIterator(previous.getIteratorInternal(getEndAngle()), PathIterator.SEG_CUBICTO, //
-                cp1.getX(), cp1.getY(), cp2.getX(), cp2.getY(), endX, endY //
+                    cp1.getX(), cp1.getY(), cp2.getX(), cp2.getY(), endX, endY //
             );
             
@@ -574,4 +591,21 @@
     public abstract Path subpath(double from, double to);
     
+    public Path subpath(double from, double to, boolean fixArgs) {
+        if (fixArgs) {
+            from = min(max(from, 0), getLength());
+            to = min(max(to, 0), getLength());
+        }
+        
+        return subpath(from, to);
+    }
+    
     public abstract Point2D getPoint(double offset);
+    
+    public Point2D getPoint(double offset, boolean fixArgs) {
+        if (fixArgs) {
+            offset = min(max(offset, 0), getLength());
+        }
+        
+        return getPoint(offset);
+    }
 }
