Skip to content

Commit 2edbc97

Browse files
committed
LLR: fix printing of invalid parent reference
1 parent b134c08 commit 2edbc97

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/compiler/llr/pretty_print.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,10 @@ fn print_local_ref<T>(
234234
_ => write!(f, "<invalid reference in global>"),
235235
}
236236
} else {
237-
let mut sc = &ctx.compilation_unit.sub_components
238-
[ctx.parent_sub_component_idx(parent_level).unwrap()];
237+
let Some(s) = ctx.parent_sub_component_idx(parent_level) else {
238+
return write!(f, "<invalid parent reference>");
239+
};
240+
let mut sc = &ctx.compilation_unit.sub_components[s];
239241

240242
for i in &local_ref.sub_component_path {
241243
write!(f, "{}.", sc.sub_components[*i].name)?;

0 commit comments

Comments
 (0)