From daabd0d202eacad67817f6f3e400a15f1ca1a9b2 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 2 Sep 2026 22:15:50 +0200 Subject: [PATCH] fix: check if structural is loaded --- src/rougail/structural_hcl/annotator.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rougail/structural_hcl/annotator.py b/src/rougail/structural_hcl/annotator.py index dd69b0b..ca0a345 100644 --- a/src/rougail/structural_hcl/annotator.py +++ b/src/rougail/structural_hcl/annotator.py @@ -49,7 +49,7 @@ class Annotator(Walk): hasattr(child, "hcl_type") and child.hcl_type == "block" ) information_value = None - if child.hcl_type == "label": + if hasattr(child, "hcl_type") and child.hcl_type == "label": if is_label == False: raise Exception() information_value = "label" @@ -70,9 +70,8 @@ class Annotator(Walk): self.objectspace.informations.add( child.path, "hcl_type", information_value ) - hcl_name = getattr(child, "hcl_name") - if hcl_name: - self.objectspace.informations.add(child.path, "hcl_name", hcl_name) + if hasattr(child, "hcl_name") and child.hcl_name: + self.objectspace.informations.add(child.path, "hcl_name", child.hcl_name) return is_label def parse_variable(self):