From 7f1a7ff66343dd23eaa0210ad6b72986c7949c14 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 09:01:52 -0700 Subject: [PATCH] Harden detection of missing nested types (#3099) --- crates/libs/metadata/src/reader.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/libs/metadata/src/reader.rs b/crates/libs/metadata/src/reader.rs index e9aa90287b..7e973cee9e 100644 --- a/crates/libs/metadata/src/reader.rs +++ b/crates/libs/metadata/src/reader.rs @@ -276,8 +276,11 @@ impl Reader { // TODO: this needs to be deferred via a TypeName's optional nested type name? if let Some(outer) = enclosing { if full_name.namespace().is_empty() { - let nested = &self.nested[&outer]; - let Some(inner) = nested.get(full_name.name()) else { + let Some(inner) = self + .nested + .get(&outer) + .and_then(|nested| nested.get(full_name.name())) + else { panic!( "Nested type not found: {}.{}", outer.type_name(),