diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index 864d26824..724ecc923 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -647,6 +647,9 @@ sub generate_toolpaths { sub generate_pillars_shape { my ($self, $contact, $support_z, $shape) = @_; + # this prevents supplying an empty point set to BoundingBox constructor + return if !%$contact; + my $pillar_size = scale PILLAR_SIZE; my $pillar_spacing = scale PILLAR_SPACING; @@ -658,7 +661,7 @@ sub generate_pillars_shape { [$pillar_size, $pillar_size], [0, $pillar_size], ); - + my @pillars = (); my $bb = Slic3r::Geometry::BoundingBox->new_from_points([ map @$_, map @$_, values %$contact ]); for (my $x = $bb->x_min; $x <= $bb->x_max-$pillar_size; $x += $pillar_spacing) { diff --git a/xs/src/BoundingBox.cpp b/xs/src/BoundingBox.cpp index 70d688e50..446414115 100644 --- a/xs/src/BoundingBox.cpp +++ b/xs/src/BoundingBox.cpp @@ -6,6 +6,7 @@ namespace Slic3r { template BoundingBoxBase::BoundingBoxBase(const std::vector &points) { + if (points.empty()) CONFESS("Empty point set supplied to BoundingBoxBase constructor"); typename std::vector::const_iterator it = points.begin(); this->min.x = this->max.x = it->x; this->min.y = this->max.y = it->y; @@ -22,6 +23,7 @@ template BoundingBox3Base::BoundingBox3Base(const std::vector &points) : BoundingBoxBase(points) { + if (points.empty()) CONFESS("Empty point set supplied to BoundingBox3Base constructor"); typename std::vector::const_iterator it = points.begin(); this->min.z = this->max.z = it->z; for (++it; it != points.end(); ++it) {