Browse Source

KWSys: Correctly handle empty environment variables

Fix a crash which occurs when SystemTools::GetPath attempts to process
an empty environment variable.

Author: Vladimir Panteleev <[email protected]>
Brad King 14 years ago
parent
commit
c544545c63
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Source/kwsys/SystemTools.cxx

+ 1 - 1
Source/kwsys/SystemTools.cxx

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