Skip to content

Commit 1d8593e

Browse files
authored
src: fix accessing empty string
PR-URL: nodejs#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>
1 parent d384151 commit 1d8593e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_dotenv.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void Dotenv::ParseContent(const std::string_view input) {
156156
key = trim_spaces(key);
157157

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

0 commit comments

Comments
 (0)