mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 12:57:57 +00:00
Catch errors in entity traversal while adding a new entity. In particular for late bound instances having unset attributes.
This commit is contained in:
@@ -981,12 +981,14 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
|
|||||||
|
|
||||||
// Obtain all forward references by a depth-first
|
// Obtain all forward references by a depth-first
|
||||||
// traversal and add them to the file.
|
// traversal and add them to the file.
|
||||||
{ IfcEntityList::ptr entity_attributes = traverse(entity, 1);
|
try {
|
||||||
for (IfcEntityList::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
|
IfcEntityList::ptr entity_attributes = traverse(entity, 1);
|
||||||
if (*it != entity) {
|
for (IfcEntityList::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
|
||||||
entity_file_map.insert(entity_entity_map_t::value_type(*it, addEntity(*it)));
|
if (*it != entity) {
|
||||||
|
entity_file_map.insert(entity_entity_map_t::value_type(*it, addEntity(*it)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} }
|
} catch (...) {}
|
||||||
|
|
||||||
// See whether the instance is already part of a file
|
// See whether the instance is already part of a file
|
||||||
if (entity->entity->file != 0) {
|
if (entity->entity->file != 0) {
|
||||||
@@ -1109,7 +1111,10 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
|
|||||||
byid[new_id] = entity;
|
byid[new_id] = entity;
|
||||||
|
|
||||||
// The mapping by reference is updated.
|
// The mapping by reference is updated.
|
||||||
IfcEntityList::ptr entity_attributes = traverse(entity, 1);
|
IfcEntityList::ptr entity_attributes(new IfcEntityList);
|
||||||
|
try {
|
||||||
|
entity_attributes = traverse(entity, 1);
|
||||||
|
} catch (...) {}
|
||||||
for (IfcEntityList::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
|
for (IfcEntityList::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
|
||||||
IfcUtil::IfcBaseClass* entity_attribute = *it;
|
IfcUtil::IfcBaseClass* entity_attribute = *it;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user