summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/lock_stitch.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-04-27 09:29:44 +0200
committerGitHub <noreply@github.com>2025-04-27 09:29:44 +0200
commit3a359bc126fc91888466ef1b17261d934ad95d9c (patch)
tree60350c80515556eb52cfed91d3f8118c85b5ec6c /lib/stitch_plan/lock_stitch.py
parent6f5fb1d9a26a4b00f3c254dd85cff28806b4aee3 (diff)
prevent possbile RecursionError for relative lock stitches (#3695)
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]