diff --git a/src/node_dotenv.cc b/src/node_dotenv.cc index 53faf461bb42f2..e884b88c3f8449 100644 --- a/src/node_dotenv.cc +++ b/src/node_dotenv.cc @@ -118,9 +118,7 @@ void Dotenv::ParseContent(const std::string_view content) { // Remove trailing whitespaces value.erase(value.find_last_not_of(" \t") + 1); - const char maybeQuote = value.front(); - - if (maybeQuote == '"') { + if (!value.empty() && value.front() == '"') { value = std::regex_replace(value, std::regex("\\\\n"), "\n"); value = std::regex_replace(value, std::regex("\\\\r"), "\r"); }