diff --git a/src/util/lean_path.cpp b/src/util/lean_path.cpp index bd40320c34..0abb9b9c93 100644 --- a/src/util/lean_path.cpp +++ b/src/util/lean_path.cpp @@ -43,7 +43,11 @@ optional get_leanpkg_path_file() { std::string get_user_leanpkg_path() { // TODO(gabriel): check if this works on windows - return std::string(getenv("HOME")) + get_dir_sep() + ".lean" + get_dir_sep() + "leanpkg.path"; + if (auto home = getenv("HOME")) { + return std::string(home) + get_dir_sep() + ".lean" + get_dir_sep() + "leanpkg.path"; + } else { + return "/could-not-find-home"; + } } static optional begins_with(std::string const & s, std::string const & prefix) {