BUG: If the scanner is not defined this would crash. For example when using new language

This commit is contained in:
Andy Cedilnik 2005-08-19 10:13:04 -04:00
parent 904305e3cb
commit 8d8c3be72b
1 changed files with 18 additions and 18 deletions

View File

@ -2830,26 +2830,26 @@ cmLocalUnixMakefileGenerator3
}
#endif
// for each file we need to scan
std::string srcLang = "CMAKE_DEPENDS_CHECK_";
srcLang += lang;
const char *srcStr = mf->GetSafeDefinition(srcLang.c_str());
std::vector<std::string> srcs;
cmSystemTools::ExpandListArgument(srcStr, srcs);
for (std::vector<std::string>::iterator si =
srcs.begin(); si != srcs.end(); ++si)
{
std::string &src = *si;
++si;
// make sure the object file is relative to home output
std::string obj = *si;
obj = lg->Convert(obj.c_str(),HOME_OUTPUT,MAKEFILE);
scanner->Write(src.c_str(),obj.c_str(),ruleFileStream);
}
// free the scanner for this language
if (scanner)
{
// for each file we need to scan
std::string srcLang = "CMAKE_DEPENDS_CHECK_";
srcLang += lang;
const char *srcStr = mf->GetSafeDefinition(srcLang.c_str());
std::vector<std::string> srcs;
cmSystemTools::ExpandListArgument(srcStr, srcs);
for (std::vector<std::string>::iterator si =
srcs.begin(); si != srcs.end(); ++si)
{
std::string &src = *si;
++si;
// make sure the object file is relative to home output
std::string obj = *si;
obj = lg->Convert(obj.c_str(),HOME_OUTPUT,MAKEFILE);
scanner->Write(src.c_str(),obj.c_str(),ruleFileStream);
}
// free the scanner for this language
delete scanner;
}
}