From 71359ee453eee3cf40cb4d6fd9926199522744fe Mon Sep 17 00:00:00 2001 From: meiskam <634802+meiskam@users.noreply.github.com> Date: Thu, 3 Nov 2022 01:08:57 -0400 Subject: [PATCH] LibCore: Handle resolving executable paths even when PATH is null This fixes a crash when trying to run `Escalator Terminal` from Run --- Userland/Libraries/LibCore/File.cpp | 5 +++-- 1 file 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 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;