From a2b876e2618618d6b9990c31b142b14e728afd6b Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 14 Aug 2017 12:50:35 +0200 Subject: [PATCH] Fixing a crash on pressing +/- with no object active. https://github.com/prusa3d/Slic3r/issues/467 --- lib/Slic3r/GUI/Plater.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 24373dc5a..1c3ac041e 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -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) {