From 3a359bc126fc91888466ef1b17261d934ad95d9c Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 27 Apr 2025 09:29:44 +0200 Subject: prevent possbile RecursionError for relative lock stitches (#3695) --- lib/stitch_plan/lock_stitch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/stitch_plan/lock_stitch.py') 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] -- cgit v1.2.3