1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-16 10:09:58 +00:00

Take into account that PATH could be empty

This commit is contained in:
Carles Fernandez 2019-03-03 10:57:05 +01:00
parent 5cbafa276f
commit 0564b790e7
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -2082,10 +2082,13 @@ bool Gnuplot::get_program_path()
// Retrieves a C string containing the value of environment variable PATH
path = std::getenv("PATH");
std::stringstream s;
s << path;
if (s.fail())
if (!path)
{
throw GnuplotException("Path is not set");
s << path;
}
if (s.fail() or s.gcount() == 0)
{
throw GnuplotException("PATH is not set");
}
std::string path_str = s.str();