Skip to content

Commit

Permalink
fix: Don't crash if a type is not set for a property
Browse files Browse the repository at this point in the history
  • Loading branch information
micha91 committed Nov 19, 2024
1 parent 0601005 commit 37fd9a9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion capella_ros_tools/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<undefined>"

type_def = data_model.TypeDef(name=type_name, card=card)
prop_def = data_model.FieldDef(
type=type_def,
name=prop_obj.name,
Expand Down

0 comments on commit 37fd9a9

Please sign in to comment.