diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 11339955a..6e8067382 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -184,13 +184,13 @@ sub slice { $self->meshes->[$region_id] = undef; # free memory } - die "Invalid input file\n" if !@{$self->layers}; # free memory $self->meshes(undef); # remove last layer(s) if empty - pop @{$self->layers} while !map @{$_->lines}, @{$self->layers->[-1]->regions}; + pop @{$self->layers} while @{$self->layers} && (!map @{$_->lines}, @{$self->layers->[-1]->regions}); + die "Invalid or too thin input file: no layers could be generated\n" if !@{$self->layers}; foreach my $layer (@{ $self->layers }) { # make sure all layers contain layer region objects for all regions