summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;