Fix segfault.

This commit is contained in:
Christian Speckner 2019-12-08 20:50:41 +01:00
parent ff7ac2de65
commit 81bc65bf56
1 changed files with 3 additions and 2 deletions

View File

@ -250,8 +250,9 @@ namespace BSPF
inline string getenv(const string& env_var)
{
try {
string result(std::getenv(env_var.c_str()));
return result;
const char* val = std::getenv(env_var.c_str());
return val ? string(val) : EmptyString;
}
catch(...) {
return EmptyString;