From 89729409065c1091316700561bd62f920cfd7a64 Mon Sep 17 00:00:00 2001 From: Andrew Schweitzer Date: Wed, 25 Sep 2024 14:38:48 -0400 Subject: [PATCH] Fix HardwareLayout.cac() for case where node has no component --- src/gwproto/data_classes/hardware_layout.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gwproto/data_classes/hardware_layout.py b/src/gwproto/data_classes/hardware_layout.py index cc98c3f0..c20869e2 100644 --- a/src/gwproto/data_classes/hardware_layout.py +++ b/src/gwproto/data_classes/hardware_layout.py @@ -329,7 +329,10 @@ def component(self, node_alias: str) -> Optional[Component]: return self.component_from_node(self.node(node_alias, None)) def cac(self, node_alias: str) -> Optional[ComponentAttributeClassGt]: - return self.component(node_alias).cac + component = self.component(node_alias) + if component is None: + return None + return component.cac def get_component_as_type(self, component_id: str, type_: Type[T]) -> Optional[T]: component = self.components.get(component_id, None)