diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2012-11-05 18:59:31 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2012-11-05 18:59:31 +0400 |
commit | 0bff8ad576e80c5f23851736b0b953d43f543b69 (patch) | |
tree | c8afc9d40d1a2d0adfc3831ef9c8ebe5ebbc7632 | |
parent | 0a912c631633ac0b377613a6866a65d479b0c213 (diff) |
Bugfix: some multimaterial files generated a fatal error
-rw-r--r-- | lib/Slic3r/Layer.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 18169fd1d..0a0213a0b 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -72,12 +72,13 @@ sub region { my $self = shift; my ($region_id) = @_; - if (!defined $self->regions->[$region_id]) { - $self->regions->[$region_id] = Slic3r::Layer::Region->new( + for (my $i = @{$self->regions}; $i <= $region_id; $i++) { + $self->regions->[$i] //= Slic3r::Layer::Region->new( layer => $self, - region => $self->object->print->regions->[$region_id], + region => $self->object->print->regions->[$i], ); } + return $self->regions->[$region_id]; } |