This patch fixes a crash which occurs when SystemTools::GetPath attempts
to process an empty environment variable.
---
 Source/kwsys/SystemTools.cxx |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index ed7f62c..4d83293 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/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;
     }
-- 
1.7.6.msysgit.0.579.ga3d6f

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to