Skip to content

Commit 352e361

Browse files
committed
Check for nullptr before resolving inverses
1 parent 9efc9d2 commit 352e361

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/ifcparse/IfcUtil.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ AttributeValue IfcUtil::IfcBaseEntity::get(const std::string& name) const
231231
}
232232

233233
aggregate_of_instance::ptr IfcUtil::IfcBaseEntity::get_inverse(const std::string& name) const {
234+
if (file_ == nullptr) {
235+
throw IfcParse::IfcException("Instance not added to file");
236+
}
234237
const std::vector<const IfcParse::inverse_attribute*> attrs = declaration().as_entity()->all_inverse_attributes();
235238
std::vector<const IfcParse::inverse_attribute*>::const_iterator iter = attrs.begin();
236239
for (; iter != attrs.end(); ++iter) {

0 commit comments

Comments
 (0)