From e0cecd6fa444e3b7ea2391ce4f2953ae9fd5f3fa Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 23 Jul 2018 20:15:49 -0400 Subject: fix a couple crashes --- lib/stitch_plan/stitch_plan.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/stitch_plan/stitch_plan.py') diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 0fa87d71..a7cd60e8 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -45,6 +45,10 @@ def patches_to_stitch_plan(patches, collapse_len=3.0 * PIXELS_PER_MM): color_block.add_stitch(stop=True) color_block = stitch_plan.new_color_block(color_block.color) + if len(color_block) == 0: + # last block ended in a stop, so now we have an empty block + del stitch_plan.color_blocks[-1] + stitch_plan.filter_duplicate_stitches() stitch_plan.add_ties() -- cgit v1.2.3