From 0e51b7b1fcd933c86271cd51e7c487754e7925f6 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 14 Oct 2026 14:57:31 -0400 Subject: [PATCH] Fix up #67: use get_mut in the outline-morph cache instead of indexing Co-Authored-By: Claude Opus 5.5 --- crates/render/src/morph_path.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/render/src/morph_path.rs b/crates/render/src/morph_path.rs index 33af94ed..6947053f 100644 --- a/crates/render/src/morph_path.rs +++ b/crates/render/src/morph_path.rs @@ -76,9 +76,12 @@ impl Cache { self.morphs.len() - 1 } }; - let (_, m, used) = &mut self.morphs[k]; - *used = true; let scale = |x: Xfrm| Vec2::new(ratio(w, x.w), ratio(h, x.h)); + let Some((_, m, used)) = self.morphs.get_mut(k) else { + // Not reachable (k was just found or pushed); align afresh rather than panic. + return Source::of(pm, s).build().at(pm.t, scale(pm.from_box), scale(pm.to_box)); + }; + *used = true; m.at(pm.t, scale(pm.from_box), scale(pm.to_box)) }