KWSys: Correctly handle empty environment variables
Fix a crash which occurs when SystemTools::GetPath attempts to process an empty environment variable. Author: Vladimir Panteleev <vladimir@thecybershadow.net>
This commit is contained in:
parent
0a6543d957
commit
c544545c63
|
@ -326,7 +326,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
|
|||
kwsys_stl::string pathEnv = cpathEnv;
|
||||
|
||||
// A hack to make the below algorithm work.
|
||||
if(pathEnv[pathEnv.length()-1] != ':')
|
||||
if(!pathEnv.empty() && pathEnv[pathEnv.length()-1] != pathSep[0])
|
||||
{
|
||||
pathEnv += pathSep;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue