From 2728f57934651f8de7ae99064305b72d27990932 Mon Sep 17 00:00:00 2001 From: Masamichi Hosoda Date: Fri, 6 Mar 2015 19:51:22 -0700 Subject: [PATCH] PATCH: Fix unset PATH crash Per Masamichi Hosada: On Windows, lilypond crashes when the environment variable PATH is not set. ``` C:\tmp\lilypond-2.19.16-0.mingw\$_OUTDIR\usr\bin>set PATH= C:\tmp\lilypond-2.19.16-0.mingw\$_OUTDIR\usr\bin>lilypond GNU LilyPond 2.19.16 terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. C:\tmp\lilypond-2.19.16-0.mingw\$_OUTDIR\usr\bin> ``` Even in the case of linux, this issue is a possible crash. --- lily/relocate.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lily/relocate.cc b/lily/relocate.cc index 2adfb6f2f7..73fde03f15 100644 --- a/lily/relocate.cc +++ b/lily/relocate.cc @@ -181,7 +181,9 @@ setup_paths (char const *argv0_ptr) { /* Find absolute ARGV0 name, using PATH. */ File_path path; - path.parse_path (getenv ("PATH")); + char *p = getenv ("PATH"); + if (p) + path.parse_path (p); #ifndef __MINGW32__ argv0_abs = path.find (argv0_filename.to_string ()); -- 2.39.5