BUG: Fixed crash when CMAKE_ROOT cannot be found.

This commit is contained in:
Brad King 2003-01-22 10:33:34 -05:00
parent c7b5bb6d2c
commit 486454ef78
4 changed files with 22 additions and 5 deletions

View File

@ -127,7 +127,15 @@ int main(int argc, char** argv)
cmCursesMainForm* myform;
myform = new cmCursesMainForm(args, x);
myform->LoadCache(cacheDir.c_str());
if(myform->LoadCache(cacheDir.c_str()))
{
curses_clear();
touchwin(stdscr);
endwin();
delete myform;
std::cerr << "Error running cmake::LoadCache(). Aboriting.\n";
return 1;
}
cmSystemTools::SetErrorCallback(CMakeErrorHandler, myform);

View File

@ -1058,11 +1058,16 @@ void cmCursesMainForm::HandleInput()
}
}
void cmCursesMainForm::LoadCache(const char *)
int cmCursesMainForm::LoadCache(const char *)
{
m_CMakeInstance->LoadCache();
int r = m_CMakeInstance->LoadCache();
if(r < 0)
{
return r;
}
m_CMakeInstance->SetCacheArgs(m_Args);
return r;
}

View File

@ -101,7 +101,7 @@ public:
/**
* Used by main program
*/
void LoadCache(const char *dir);
int LoadCache(const char *dir);
/**
* Progress callback

View File

@ -924,7 +924,11 @@ int cmake::Run(const std::vector<std::string>& args)
m_CMakeCommand = args[0];
// load the cache
this->LoadCache();
if(this->LoadCache() < 0)
{
cmSystemTools::Error("Error executing cmake::LoadCache(). Aborting.\n");
return -1;
}
// Add any cache args
this->SetCacheArgs(args);