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:
Brad King 2011-12-15 15:45:09 -05:00
parent 0a6543d957
commit c544545c63
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}