Prevent crash when trying to export G-code from menu and there are no objects

This commit is contained in:
Alessandro Ranellucci 2014-06-14 22:40:37 +02:00
parent 87383250de
commit 707dd8db86

View File

@ -877,6 +877,8 @@ sub resume_background_process {
sub export_gcode {
my $self = shift;
return if !@{$self->{objects}};
if ($self->{export_gcode_output_file}) {
Wx::MessageDialog->new($self, "Another export job is currently running.", 'Error', wxOK | wxICON_ERROR)->ShowModal;
return;
@ -1023,6 +1025,8 @@ sub on_export_completed {
sub export_stl {
my $self = shift;
return if !@{$self->{objects}};
my $output_file = $self->_get_export_file('STL') or return;
Slic3r::Format::STL->write_file($output_file, $self->{model}, binary => 1);
$self->statusbar->SetStatusText("STL file exported to $output_file");
@ -1034,6 +1038,8 @@ sub export_stl {
sub export_amf {
my $self = shift;
return if !@{$self->{objects}};
my $output_file = $self->_get_export_file('AMF') or return;
Slic3r::Format::AMF->write_file($output_file, $self->{model});
$self->statusbar->SetStatusText("AMF file exported to $output_file");