From ee82e56a4fff52a9bc2e01f5a961be5eb34cf891 Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Mon, 10 Feb 2014 16:02:47 +0100
Subject: [PATCH] Bugfix: crashing when concentric infill produced very narrow
 loops. #1740

---
 lib/Slic3r/Fill/Concentric.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/Slic3r/Fill/Concentric.pm b/lib/Slic3r/Fill/Concentric.pm
index 75dce8d23..10cc7aeb6 100644
--- a/lib/Slic3r/Fill/Concentric.pm
+++ b/lib/Slic3r/Fill/Concentric.pm
@@ -47,9 +47,10 @@ sub fill_surface {
         $last_pos = $paths[-1]->last_point;
     }
     
-    # clip the paths to avoid the extruder to get exactly on the first point of the loop
+    # clip the paths to prevent the extruder from getting exactly on the first point of the loop
     my $clip_length = scale $flow_spacing * &Slic3r::LOOP_CLIPPING_LENGTH_OVER_SPACING;
     $_->clip_end($clip_length) for @paths;
+    @paths = grep $_->is_valid, @paths;  # remove empty paths (too short, thus eaten by clipping)
     
     # TODO: return ExtrusionLoop objects to get better chained paths
     return { flow_spacing => $flow_spacing, no_sort => 1 }, @paths;