mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
Shell: Resolve nonexistent string env variables to the empty string
We did this for lists, but not for strings.
This commit is contained in:
parent
d997b794fa
commit
d0112d76e9
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/alimpfard
Commit: d0112d76e9
Pull-request: https://github.com/SerenityOS/serenity/pull/17953
1 changed files with 4 additions and 1 deletions
|
@ -3802,7 +3802,10 @@ ErrorOr<String> SimpleVariableValue::resolve_as_string(RefPtr<Shell> shell)
|
|||
return resolve_slices(shell, TRY(value->resolve_as_string(shell)), m_slices);
|
||||
|
||||
auto name = m_name.to_deprecated_string();
|
||||
char* env_value = getenv(name.characters());
|
||||
char const* env_value = getenv(name.characters());
|
||||
if (!env_value)
|
||||
env_value = "";
|
||||
|
||||
return resolve_slices(shell, TRY(String::from_utf8(StringView { env_value, strlen(env_value) })), m_slices);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue