From e740e74f900465daf4bffb9361cf42bdbf47ffc8 Mon Sep 17 00:00:00 2001 From: Masamichi Hosoda Date: Thu, 30 Jun 2016 23:22:55 +0900 Subject: [PATCH] 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. --- lily/general-scheme.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.39.5