Skip to content

Commit

Permalink
src: fix accessing empty string
Browse files Browse the repository at this point in the history
PR-URL: #57014
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
zcbenz authored and targos committed Feb 17, 2025
1 parent fa26f83 commit 286bb84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_dotenv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void Dotenv::ParseContent(const std::string_view input) {
key = trim_spaces(key);

// If the value is not present (e.g. KEY=) set is to an empty string
if (content.front() == '\n') {
if (content.empty() || content.front() == '\n') {
store_.insert_or_assign(std::string(key), "");
continue;
}
Expand Down

0 comments on commit 286bb84

Please # to comment.