Check for nullptr before resolving inverses

This commit is contained in:
Thomas Krijnen
2024-12-19 10:40:59 +01:00
parent 9efc9d2044
commit 352e361ea5
+3
View File
@@ -231,6 +231,9 @@ AttributeValue IfcUtil::IfcBaseEntity::get(const std::string& name) const
}
aggregate_of_instance::ptr IfcUtil::IfcBaseEntity::get_inverse(const std::string& name) const {
if (file_ == nullptr) {
throw IfcParse::IfcException("Instance not added to file");
}
const std::vector<const IfcParse::inverse_attribute*> attrs = declaration().as_entity()->all_inverse_attributes();
std::vector<const IfcParse::inverse_attribute*>::const_iterator iter = attrs.begin();
for (; iter != attrs.end(); ++iter) {