From dcc0ce78dbcad651e3a6e34ea6b71dcff6d6669d Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Thu, 20 Dec 2012 17:03:50 +0100
Subject: [PATCH] Fix warning

---
 lib/Slic3r/Print.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm
index a8cb82a83..85f7470ff 100644
--- a/lib/Slic3r/Print.pm
+++ b/lib/Slic3r/Print.pm
@@ -742,8 +742,8 @@ sub write_gcode {
         # prepare callback to call as soon as a Z command is generated
         $gcodegen->move_z_callback(sub {
             $gcodegen->move_z_callback(undef);  # circular ref or not?
-            return $Slic3r::Config->replace_options($Slic3r::Config->layer_gcode) . "\n"
-                if $Slic3r::Config->layer_gcode;
+            return "" if !$Slic3r::Config->layer_gcode;
+            return $Slic3r::Config->replace_options($Slic3r::Config->layer_gcode) . "\n";
         });
         
         # extrude skirt