Skip to content

Commit

Permalink
Fixing a crash on pressing +/- with no object active.
Browse files Browse the repository at this point in the history
  • Loading branch information
bubnikv committed Aug 14, 2017
1 parent 3b54b68 commit a2b876e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Slic3r/GUI/Plater.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit a2b876e

Please sign in to comment.