summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/lock_stitch.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitch_plan/lock_stitch.py')
-rwxr-xr-xlib/stitch_plan/lock_stitch.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/stitch_plan/lock_stitch.py b/lib/stitch_plan/lock_stitch.py
index 98219154..706ec66d 100755
--- a/lib/stitch_plan/lock_stitch.py
+++ b/lib/stitch_plan/lock_stitch.py
@@ -98,7 +98,9 @@ class RelativeLock(LockStitchDefinition):
return lock_stitches
def get_direction_and_length(self, stitches, i=1):
- if len(stitches) < i+1:
+ if len(stitches) < i+1 or i > 15:
+ # we exceeded the stitch length of the path or tried 15 times already
+ # we don't want to try any longer and return a default value
return Stitch(1, 0), 0.5
to_previous = stitches[i] - stitches[0]