Skip to content

Commit 6ee283d

Browse files
committed
Don't fail on parse errors while resolving inverse attributes
1 parent c748c8d commit 6ee283d

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/ifcparse/IfcParse.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,15 +1896,20 @@ IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum ty
18961896
for(IfcEntityList::it it = all->begin(); it != all->end(); ++it) {
18971897
bool valid = type == IfcSchema::Type::UNDEFINED || (*it)->is(type);
18981898
if (valid && attribute_index >= 0) {
1899-
Argument* arg = (*it)->entity->getArgument(attribute_index);
1900-
if (arg->type() == IfcUtil::Argument_ENTITY_INSTANCE) {
1901-
valid = instance == *arg;
1902-
} else if (arg->type() == IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
1903-
IfcEntityList::ptr li = *arg;
1904-
valid = li->contains(instance);
1905-
} else if (arg->type() == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
1906-
IfcEntityListList::ptr li = *arg;
1907-
valid = li->contains(instance);
1899+
try {
1900+
Argument* arg = (*it)->entity->getArgument(attribute_index);
1901+
if (arg->type() == IfcUtil::Argument_ENTITY_INSTANCE) {
1902+
valid = instance == *arg;
1903+
} else if (arg->type() == IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
1904+
IfcEntityList::ptr li = *arg;
1905+
valid = li->contains(instance);
1906+
} else if (arg->type() == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
1907+
IfcEntityListList::ptr li = *arg;
1908+
valid = li->contains(instance);
1909+
}
1910+
} catch (IfcException& e) {
1911+
valid = false;
1912+
Logger::Error(e);
19081913
}
19091914
}
19101915
if (valid) {

0 commit comments

Comments
 (0)