Skip to content

Commit e05e2cf

Browse files
zcbenzRafaelGSS
authored andcommitted
src: fix accessing empty string
PR-URL: #57014 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 619e52c commit e05e2cf

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)