From d60fbd2c093931a89e3324bdcfda95a7cf840729 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 1 Jun 2023 14:06:41 +0200 Subject: [PATCH] Don't assert but just if-check for not terminating rule execution on very invalid files --- .../ifcopenshell/express/rule_executor.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py b/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py index e9b66a56fb..9ba2a592e8 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py @@ -197,10 +197,14 @@ def run(f, logger): type = type.declared_type() if isinstance(value, (list, tuple)): - assert isinstance(type, ifcopenshell.ifcopenshell_wrapper.aggregation_type) - ty = type.type_of_element() - for v in value: - check(v, ty, instance=inst) + if isinstance(type, ifcopenshell.ifcopenshell_wrapper.aggregation_type): + ty = type.type_of_element() + for v in value: + check(v, ty, instance=inst) + else: + # Let's hope a schema validation error was reported for this case + pass + elif isinstance(value, ifcopenshell.entity_instance): if isinstance( S.declaration_by_name(value.is_a()),