From c3ca0612701c64896d10f0df88da08bb66ecde56 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sat, 15 Nov 2025 01:10:19 +0000 Subject: [PATCH] fix impl --- mcp_codebase.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mcp_codebase.py b/mcp_codebase.py index 08ff085..c9e9f04 100644 --- a/mcp_codebase.py +++ b/mcp_codebase.py @@ -1986,13 +1986,15 @@ def build_indexes(): graph.add_node(node_id, **base_attrs, type=node_type) - # Try to find the target struct/trait that this impl implements + # Guard against empty lists that can be returned by the Rust parser target_name = None - if "implements_traits" in m: - target_name = m["implements_traits"][0] # assume first trait - elif "implements" in m: + if "implements_traits" in m and isinstance(m["implements_traits"], list) and m["implements_traits"]: + # assume first trait + target_name = m["implements_traits"][0] + elif "implements" in m and isinstance(m["implements"], list) and m["implements"]: target_name = m["implements"][0] + if target_name: target_node_id = f"{lang}::struct::{fpath}::{target_name}" if target_node_id not in graph.graph: