From 116675a19106b3d17b85299ddb3f98e8978f48f8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 16 Sep 2023 00:31:53 +0300 Subject: [PATCH] Don't try to fetch the value of a nonexistent environment variable --- source/core/windows/environ.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/windows/environ.cpp b/source/core/windows/environ.cpp index 2dd9d4c..b9ec27a 100644 --- a/source/core/windows/environ.cpp +++ b/source/core/windows/environ.cpp @@ -21,7 +21,7 @@ string getenv(const string &name) MutexLock _lock(env_mutex()); string value; size_t length = 0; - if(!getenv_s(&length, nullptr, 0, name.c_str())) + if(!getenv_s(&length, nullptr, 0, name.c_str()) && length>0) { value.resize(length); if(!getenv_s(&length, &value[0], value.size(), name.c_str())) -- 2.45.2