summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-21 14:33:07 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-21 14:33:07 (GMT)
commit00095676ccdd3d16dd0c9251789e8fedad630fdf (patch)
tree0b89a3ea7222beb1680f66f0d24725726110869c /Source
parent61f602d66876414aadee14cf4be68f07ec9eaad3 (diff)
downloadCMake-00095676ccdd3d16dd0c9251789e8fedad630fdf.zip
CMake-00095676ccdd3d16dd0c9251789e8fedad630fdf.tar.gz
CMake-00095676ccdd3d16dd0c9251789e8fedad630fdf.tar.bz2
BUG: Prevent crash when the current working directory cannot be established
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/SystemTools.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index ac5c1b0..8b26cb3 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1281,7 +1281,12 @@ int SystemTools::ChangeDirectory(const char *dir)
kwsys_stl::string SystemTools::GetCurrentWorkingDirectory()
{
char buf[2048];
- kwsys_stl::string path = Getcwd(buf, 2048);
+ const char* cwd = Getcwd(buf, 2048);
+ kwsys_stl::string path;
+ if ( cwd )
+ {
+ path = cwd;
+ }
return path;
}