Skip to content

Commit

Permalink
Bugfix: crash when input to bed shape options was '-'. #3254
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Mar 18, 2016
1 parent c12ccd8 commit e2aae39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Slic3r/GUI/BedShapeDialog.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ sub GetValue {
package Slic3r::GUI::BedShapePanel;

use List::Util qw(min max sum first);
use Scalar::Util qw(looks_like_number);
use Slic3r::Geometry qw(PI X Y scale unscale scaled_epsilon deg2rad);
use Wx qw(:font :id :misc :sizer :choicebook :filedialog :pen :brush wxTAB_TRAVERSAL);
use Wx::Event qw(EVT_CLOSE EVT_CHOICEBOOK_PAGE_CHANGED EVT_BUTTON);
Expand Down Expand Up @@ -189,12 +190,12 @@ sub _update_shape {
my $rect_size = $self->{optgroups}[SHAPE_RECTANGULAR]->get_value('rect_size');
my $rect_origin = $self->{optgroups}[SHAPE_RECTANGULAR]->get_value('rect_origin');
my ($x, $y) = @$rect_size;
return if !$x || !$y; # empty strings
return if !looks_like_number($x) || !looks_like_number($y); # empty strings or '-' or other things
my ($x0, $y0) = (0,0);
my ($x1, $y1) = ($x,$y);
{
my ($dx, $dy) = @$rect_origin;
return if $dx eq '' || $dy eq ''; # empty strings
return if !looks_like_number($dx) || !looks_like_number($dy); # empty strings or '-' or other things
$x0 -= $dx;
$x1 -= $dx;
$y0 -= $dy;
Expand Down

0 comments on commit e2aae39

Please sign in to comment.