Code

Extensions. Fix for Bug #652943 (Aborted output extensions create an empty file).
authorJazzyNico <nicoduf@yahoo.fr>
Wed, 6 Oct 2010 18:58:55 +0000 (20:58 +0200)
committerJazzyNico <nicoduf@yahoo.fr>
Wed, 6 Oct 2010 18:58:55 +0000 (20:58 +0200)
src/extension/implementation/script.cpp

index e075feb913bb3b4a7820250dfd4fd99651f36491..9a461ab2dc8340f68ed1dabcbb84c3b9f5947bd8 100644 (file)
@@ -602,10 +602,14 @@ void Script::save(Inkscape::Extension::Output *module,
 
 
     file_listener fileout;
-    execute(command, params, tempfilename_in, fileout);
+    int data_read = execute(command, params, tempfilename_in, fileout);
+    
+    bool success = false;
 
-    std::string lfilename = Glib::filename_from_utf8(filenameArg);
-    bool success = fileout.toFile(lfilename);
+    if (data_read > 0) {
+        std::string lfilename = Glib::filename_from_utf8(filenameArg);
+        success = fileout.toFile(lfilename);
+    }
 
     // make sure we don't leak file descriptors from g_file_open_tmp
     close(tempfd_in);