From 6a66fb22a9b064d49db980ce175f1858b8a9552a Mon Sep 17 00:00:00 2001 From: JazzyNico Date: Wed, 6 Oct 2010 20:58:55 +0200 Subject: [PATCH] Extensions. Fix for Bug #652943 (Aborted output extensions create an empty file). --- src/extension/implementation/script.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index e075feb91..9a461ab2d 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -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); -- 2.30.2