summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authormeiskam <634802+meiskam@users.noreply.github.com>2022-11-03 01:08:57 -0400
committerTim Flynn <trflynn89@pm.me>2022-11-04 11:40:41 -0400
commit71359ee453eee3cf40cb4d6fd9926199522744fe (patch)
tree9b5bb467ba1b23b903ead308e73519528db952d8 /Userland
parent892a3e7d12f74540656e766cfb08781d8071f770 (diff)
downloadserenity-71359ee453eee3cf40cb4d6fd9926199522744fe.zip
LibCore: Handle resolving executable paths even when PATH is null
This fixes a crash when trying to run `Escalator Terminal` from Run
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibCore/File.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp
index d3e08c4fea..bcf57891c9 100644
--- a/Userland/Libraries/LibCore/File.cpp
+++ b/Userland/Libraries/LibCore/File.cpp
@@ -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;