Do not crash on unknown source language (#13323)
If a source file extension is not recognized as any language then src.GetLanguage() may return NULL. Check the result before dereferencing in cmLocalGenerator::GetObjectFileNameWithoutTarget.
This commit is contained in:
parent
d17c58c853
commit
2c2fbaf0e5
|
@ -2764,10 +2764,13 @@ cmLocalGenerator
|
||||||
bool replaceExt = this->NeedBackwardsCompatibility(2, 4);
|
bool replaceExt = this->NeedBackwardsCompatibility(2, 4);
|
||||||
if(!replaceExt)
|
if(!replaceExt)
|
||||||
{
|
{
|
||||||
std::string repVar = "CMAKE_";
|
if(const char* lang = source.GetLanguage())
|
||||||
repVar += source.GetLanguage();
|
{
|
||||||
repVar += "_OUTPUT_EXTENSION_REPLACE";
|
std::string repVar = "CMAKE_";
|
||||||
replaceExt = this->Makefile->IsOn(repVar.c_str());
|
repVar += lang;
|
||||||
|
repVar += "_OUTPUT_EXTENSION_REPLACE";
|
||||||
|
replaceExt = this->Makefile->IsOn(repVar.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the source extension if it is to be replaced.
|
// Remove the source extension if it is to be replaced.
|
||||||
|
|
Loading…
Reference in New Issue