From 99c1facec6b6812538bcdda719c3a979f649c296 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 7 Dec 2011 20:18:12 +0100 Subject: [PATCH] Bugfix: division by zero when nothing in a single layer could be parsed. #100 --- lib/Slic3r/TriangleMesh.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/TriangleMesh.pm b/lib/Slic3r/TriangleMesh.pm index 6e5a537bf..5032fe25a 100644 --- a/lib/Slic3r/TriangleMesh.pm +++ b/lib/Slic3r/TriangleMesh.pm @@ -200,7 +200,9 @@ sub make_loops { my $total_discarded_length = 0; $total_discarded_length += $_->length for map polyline_lines($_), @discarded_polylines; $total_discarded_length += $_->length for @discarded_lines; - my $discarded_ratio = $total_discarded_length / $total_detected_length; + my $discarded_ratio = $total_detected_length + ? ($total_discarded_length / $total_detected_length) + : 0; Slic3r::debugf " length ratio of discarded lines is %f\n", $discarded_ratio;