Bugfix: crash when input to bed shape options was '-'. #3254

This commit is contained in:
Alessandro Ranellucci 2016-03-18 01:15:52 +01:00
parent c12ccd8357
commit e2aae39f15

View file

@ -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);
@ -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;