GHS: Fix crash when GHS_NO_SOURCE_GROUP_FILE property is not defined

Refactoring in commit 36aba01223 (cmGeneratorTarget::GetProperty: return
cmProp, 2020-04-29, v3.18.0-rc1~246^2) left out a `nullptr` check.

Fixes: #20985
This commit is contained in:
Brad King
2020-07-20 10:39:16 -04:00
parent d421274e3e
commit 5da2c71165

View File

@@ -550,8 +550,9 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
*/ */
for (auto& sg : groupFilesList) { for (auto& sg : groupFilesList) {
std::ostream* fout; std::ostream* fout;
bool useProjectFile = cmIsOn(*this->GeneratorTarget->GetProperty( cmProp noSourceGroupFile =
"GHS_NO_SOURCE_GROUP_FILE")) || this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE");
bool useProjectFile = (noSourceGroupFile && cmIsOn(*noSourceGroupFile)) ||
cmIsOn(this->Makefile->GetDefinition("CMAKE_GHS_NO_SOURCE_GROUP_FILE")); cmIsOn(this->Makefile->GetDefinition("CMAKE_GHS_NO_SOURCE_GROUP_FILE"));
if (useProjectFile || sg.empty()) { if (useProjectFile || sg.empty()) {
fout = &fout_proj; fout = &fout_proj;