From 37fd9a99d87894ee3db6e84f87fd75092882bbc0 Mon Sep 17 00:00:00 2001 From: Michael Harbarth Date: Tue, 19 Nov 2024 17:12:50 +0100 Subject: [PATCH] fix: Don't crash if a type is not set for a property --- capella_ros_tools/exporter.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/capella_ros_tools/exporter.py b/capella_ros_tools/exporter.py index 6731794..e7ab5a6 100644 --- a/capella_ros_tools/exporter.py +++ b/capella_ros_tools/exporter.py @@ -28,7 +28,16 @@ def export(current_pkg: information.DataPkg, current_path: pathlib.Path): ) except AttributeError: card = data_model.Range("1", "1") - type_def = data_model.TypeDef(name=prop_obj.type.name, card=card) + + if (_type := prop_obj.type) is not None: + type_name = _type.name + else: + logger.error( + "Type of property %s is None", prop_obj._short_repr_() + ) + type_name = "" + + type_def = data_model.TypeDef(name=type_name, card=card) prop_def = data_model.FieldDef( type=type_def, name=prop_obj.name,