Fixing a crash on pressing +/- with no object active.

https://github.com/prusa3d/Slic3r/issues/467
This commit is contained in:
bubnikv 2017-08-14 12:50:35 +02:00
parent 3b54b68b59
commit a2b876e261

View file

@ -903,9 +903,9 @@ sub reset {
sub increase {
my ($self, $copies) = @_;
$copies //= 1;
my ($obj_idx, $object) = $self->selected_object;
return if ! defined $obj_idx;
my $model_object = $self->{model}->objects->[$obj_idx];
my $instance = $model_object->instances->[-1];
for my $i (1..$copies) {
@ -930,11 +930,12 @@ sub increase {
sub decrease {
my ($self, $copies_asked) = @_;
my $copies = $copies_asked // 1;
my ($obj_idx, $object) = $self->selected_object;
return if ! defined $obj_idx;
$self->stop_background_process;
my ($obj_idx, $object) = $self->selected_object;
my $model_object = $self->{model}->objects->[$obj_idx];
if ($model_object->instances_count > $copies) {
for my $i (1..$copies) {