mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 02:17:27 +08:00
EXPORT_PROPERTIES: Prevent null dereference for undefined property
Fixes: #18260
This commit is contained in:
@@ -1143,6 +1143,11 @@ bool cmExportFileGenerator::PopulateExportProperties(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto propertyValue = targetProperties.GetPropertyValue(prop);
|
auto propertyValue = targetProperties.GetPropertyValue(prop);
|
||||||
|
if (propertyValue == nullptr) {
|
||||||
|
// Asked to export a property that isn't defined on the target. Do not
|
||||||
|
// consider this an error, there's just nothing to export.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
std::string evaluatedValue = cmGeneratorExpression::Preprocess(
|
std::string evaluatedValue = cmGeneratorExpression::Preprocess(
|
||||||
propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
|
propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
|
||||||
if (evaluatedValue != propertyValue) {
|
if (evaluatedValue != propertyValue) {
|
||||||
|
Reference in New Issue
Block a user