Don't fail on parse errors while resolving inverse attributes

This commit is contained in:
Thomas Krijnen
2018-05-04 10:25:57 +02:00
parent 7d65e9522a
commit eb9897c341
+5
View File
@@ -1896,6 +1896,7 @@ IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum ty
for(IfcEntityList::it it = all->begin(); it != all->end(); ++it) { for(IfcEntityList::it it = all->begin(); it != all->end(); ++it) {
bool valid = type == IfcSchema::Type::UNDEFINED || (*it)->is(type); bool valid = type == IfcSchema::Type::UNDEFINED || (*it)->is(type);
if (valid && attribute_index >= 0) { if (valid && attribute_index >= 0) {
try {
Argument* arg = (*it)->entity->getArgument(attribute_index); Argument* arg = (*it)->entity->getArgument(attribute_index);
if (arg->type() == IfcUtil::Argument_ENTITY_INSTANCE) { if (arg->type() == IfcUtil::Argument_ENTITY_INSTANCE) {
valid = instance == *arg; valid = instance == *arg;
@@ -1906,6 +1907,10 @@ IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum ty
IfcEntityListList::ptr li = *arg; IfcEntityListList::ptr li = *arg;
valid = li->contains(instance); valid = li->contains(instance);
} }
} catch (IfcException& e) {
valid = false;
Logger::Error(e);
}
} }
if (valid) { if (valid) {
l->push(*it); l->push(*it);