diff --git a/src/node_dotenv.cc b/src/node_dotenv.cc index fcad2f23f50557..0d0130b928e6bf 100644 --- a/src/node_dotenv.cc +++ b/src/node_dotenv.cc @@ -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; }