diff --git a/ford/sourceform.py b/ford/sourceform.py index 1d85c9f5..47b15a11 100644 --- a/ford/sourceform.py +++ b/ford/sourceform.py @@ -1477,9 +1477,9 @@ def get_label_item(context, label): context = item elif isinstance(item, FortranVariable): type_str = strip_type(item.full_type) - if item.parent is None: + if not (parent_all_types := getattr(item.parent, "all_types", {})): return None - context = item.parent.all_types.get(type_str, None) + context = parent_all_types.get(type_str, None) else: context = None