summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-12-15 20:45:09 (GMT)
committerBrad King <brad.king@kitware.com>2011-12-15 20:45:09 (GMT)
commitc544545c6364ed7081d60772505278c9f199ecf8 (patch)
tree1e89747c12d0b65fa7f31ea8cec5a6a930893058 /Source
parent0a6543d957463f0a7f7a585cc43468174c1204a0 (diff)
downloadCMake-c544545c6364ed7081d60772505278c9f199ecf8.zip
CMake-c544545c6364ed7081d60772505278c9f199ecf8.tar.gz
CMake-c544545c6364ed7081d60772505278c9f199ecf8.tar.bz2
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>
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/SystemTools.cxx2
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;
}