LibCore: Handle resolving executable paths even when PATH is null

This fixes a crash when trying to run `Escalator Terminal` from Run
This commit is contained in:
meiskam 2022-11-03 01:08:57 -04:00 committed by Tim Flynn
parent 892a3e7d12
commit 71359ee453
Notes: sideshowbarker 2024-07-17 06:35:16 +09:00

View file

@ -572,8 +572,9 @@ Optional<String> File::resolve_executable_from_environment(StringView filename)
}
auto const* path_str = getenv("PATH");
StringView path { path_str, strlen(path_str) };
StringView path;
if (path_str)
path = { path_str, strlen(path_str) };
if (path.is_empty())
path = DEFAULT_PATH_SV;