From: Masamichi Hosoda Date: Thu, 30 Jun 2016 14:22:55 +0000 (+0900) Subject: Issue 4910/3: Avoid crash when g_spawn_sync () fails X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e740e74f900465daf4bffb9361cf42bdbf47ffc8;hp=f97af256ef891d0501c9a6d7985b74a23d7ebe6a;p=lilypond.git Issue 4910/3: Avoid crash when g_spawn_sync () fails 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. --- diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 5f16d93408..1168ee9473 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -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);