BUG: Prevent crash when the current working directory cannot be established

This commit is contained in:
Andy Cedilnik 2004-04-21 10:33:07 -04:00
parent 61f602d668
commit 00095676cc

View File

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