mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Fix iteration: prevent inserting nullptr equivalents into a set
This commit is contained in:
@@ -132,7 +132,7 @@ bool mapping::reuse_ok_(const std::vector<IfcSchema::IfcProduct>& products) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<express::Base> associated_single_materials;
|
std::set<std::optional<express::Base>> associated_single_materials;
|
||||||
|
|
||||||
for (auto& product : products) {
|
for (auto& product : products) {
|
||||||
if (!settings_.get<settings::DisableOpeningSubtractions>().get() && !find_openings(product).empty()) {
|
if (!settings_.get<settings::DisableOpeningSubtractions>().get() && !find_openings(product).empty()) {
|
||||||
@@ -151,8 +151,8 @@ bool mapping::reuse_ok_(const std::vector<IfcSchema::IfcProduct>& products) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that this can be a nullptr (!), but the fact that set size should be one still holds
|
auto mat = get_single_material_association(product);
|
||||||
associated_single_materials.insert(get_single_material_association(product));
|
associated_single_materials.insert(mat ? std::optional<express::Base>{mat} : std::nullopt);
|
||||||
if (associated_single_materials.size() > 1) return false;
|
if (associated_single_materials.size() > 1) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user