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)) }