ERR: Verify that getenv returned something before using it

This commit is contained in:
Andy Cedilnik 2004-04-22 14:11:25 -04:00
parent 84a1d5e553
commit 161c31bc2b
1 changed files with 8 additions and 1 deletions

View File

@ -169,7 +169,14 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
{
env = "PATH";
}
kwsys_stl::string pathEnv = getenv(env);
const char* cpathEnv = SystemTools::GetEnv(env);
if ( !cpathEnv )
{
return;
}
kwsys_stl::string pathEnv = cpathEnv;
// A hack to make the below algorithm work.
if(pathEnv[pathEnv.length()-1] != ':')
{