From f5ce221df3ef963c51b831bf2b2cd5f7c9b64294 Mon Sep 17 00:00:00 2001 From: Cheng Date: Wed, 12 Feb 2025 19:22:27 +0900 Subject: [PATCH] src: fix accessing empty string --- src/node_dotenv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }