mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 06:04:01 -06:00
Bugfix: crash when input to bed shape options was '-'. #3254
This commit is contained in:
parent
c12ccd8357
commit
e2aae39f15
1 changed files with 3 additions and 2 deletions
|
@ -41,6 +41,7 @@ sub GetValue {
|
||||||
package Slic3r::GUI::BedShapePanel;
|
package Slic3r::GUI::BedShapePanel;
|
||||||
|
|
||||||
use List::Util qw(min max sum first);
|
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 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 qw(:font :id :misc :sizer :choicebook :filedialog :pen :brush wxTAB_TRAVERSAL);
|
||||||
use Wx::Event qw(EVT_CLOSE EVT_CHOICEBOOK_PAGE_CHANGED EVT_BUTTON);
|
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_size = $self->{optgroups}[SHAPE_RECTANGULAR]->get_value('rect_size');
|
||||||
my $rect_origin = $self->{optgroups}[SHAPE_RECTANGULAR]->get_value('rect_origin');
|
my $rect_origin = $self->{optgroups}[SHAPE_RECTANGULAR]->get_value('rect_origin');
|
||||||
my ($x, $y) = @$rect_size;
|
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 ($x0, $y0) = (0,0);
|
||||||
my ($x1, $y1) = ($x,$y);
|
my ($x1, $y1) = ($x,$y);
|
||||||
{
|
{
|
||||||
my ($dx, $dy) = @$rect_origin;
|
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;
|
$x0 -= $dx;
|
||||||
$x1 -= $dx;
|
$x1 -= $dx;
|
||||||
$y0 -= $dy;
|
$y0 -= $dy;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue