Prevent another exception being thrown upon adding entity instances to a file, as reported by ch0kee

This commit is contained in:
Thomas Krijnen
2014-11-27 09:22:58 +00:00
parent 4c976c8b70
commit 3f285ea639
+4
View File
@@ -925,6 +925,9 @@ void IfcFile::AddEntity(IfcUtil::IfcBaseClass* entity) {
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 {
if (!IfcSchema::Type::IsSimple(entity_attribute->type())) {
// At this point simple types are IfcSelectHelper instances
// which are not writable and do not have an instance name.
if (entity_attribute->entity->isWritable()) { if (entity_attribute->entity->isWritable()) {
if ( ! entity_attribute->entity->file ) { if ( ! entity_attribute->entity->file ) {
entity_attribute->entity->file = this; entity_attribute->entity->file = this;
@@ -938,6 +941,7 @@ void IfcFile::AddEntity(IfcUtil::IfcBaseClass* entity) {
byref[entity_attribute_id] = refs; byref[entity_attribute_id] = refs;
} }
refs->push(entity); refs->push(entity);
}
} catch (IfcParse::IfcException&) {} } catch (IfcParse::IfcException&) {}
} }
} }