From e14167ed2c6e638ec5a3e126004c88a8ee4a4e6a Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 10:11:03 -0500 Subject: [PATCH] harden --- 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(),