summaryrefslogtreecommitdiff
path: root/lily
diff options
context:
space:
mode:
authorMasamichi Hosoda <trueroad@trueroad.jp>2016-06-30 23:22:55 +0900
committerMasamichi Hosoda <trueroad@trueroad.jp>2016-07-08 06:45:53 +0900
commite740e74f900465daf4bffb9361cf42bdbf47ffc8 (patch)
tree8459846048fdf9fb0e5859a62b9eb6304c204198 /lily
parentf97af256ef891d0501c9a6d7985b74a23d7ebe6a (diff)
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.
Diffstat (limited to 'lily')
-rw-r--r--lily/general-scheme.cc7
1 files 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);