From: Masamichi Hosoda Date: Sat, 7 Mar 2015 02:51:22 +0000 (-0700) Subject: PATCH: Fix unset PATH crash X-Git-Tag: release/2.19.17-1^0 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2728f57934651f8de7ae99064305b72d27990932;p=lilypond.git 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. --- 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 ());