]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4910/3: Avoid crash when g_spawn_sync () fails
authorMasamichi Hosoda <trueroad@trueroad.jp>
Thu, 30 Jun 2016 14:22:55 +0000 (23:22 +0900)
committerMasamichi Hosoda <trueroad@trueroad.jp>
Thu, 7 Jul 2016 21:45:53 +0000 (06:45 +0900)
When g_spawn_sync () fails,
`standard_output` and `standard_error` may not be set.
This commit makes to check whether or not the value is valid.

lily/general-scheme.cc

index 5f16d93408d66fe7026adeb9072e90800f96cf24..1168ee947357b06d21e0099b7a7551b09a6fd9a6 100644 (file)
@@ -662,8 +662,11 @@ LY_DEFINE (ly_spawn, "ly:spawn",
   // Always get the pointer to the stdout/stderr messages
   int exit_status = ly_run_command (argv, &standard_output, &standard_error);
 
-  // Print out stdout and stderr only in debug mode
-  debug_output (string ("\n") + standard_output + standard_error, true);
+  if (standard_output && standard_error)
+    {
+      // Print out stdout and stderr only in debug mode
+      debug_output (string ("\n") + standard_output + standard_error, true);
+    }
 
   g_free (standard_error);
   g_free (standard_output);