diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 1a6238ee..08028f84 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -3469,6 +3469,8 @@ fn an_exhausted_id_space_refuses_growth() { assert!(s.execute("shape.insert", &json!({"preset": "rect", "rect": [10, 10, 100, 50]})).is_err()); assert!(s.execute("slide.duplicate", &json!({})).is_err()); assert!(s.execute("edit.duplicate", &json!({})).is_err()); + assert!(s.execute("insert.smartArt", &json!({"kind": "blockList", "items": ["Plan", "Build"]})).is_err()); + assert!(s.execute("insert.textBox", &json!({"text": "Hi"})).is_err()); // What the deck holds is untouched: same slides, same ids, no duplicates. let after = s.doc().unwrap().doc.clone(); assert_eq!(after.slides.len(), before.slides.len()); diff --git a/crates/model/src/defaults.rs b/crates/model/src/defaults.rs index 3645f332..19adc7bb 100644 --- a/crates/model/src/defaults.rs +++ b/crates/model/src/defaults.rs @@ -522,9 +522,9 @@ pub fn blank_presentation(size: Size, theme: Theme, title_slide: bool) -> Presen // A fresh deck starts at id 256 and this builds a handful of ids, so the slide always // fits; should that ever stop holding, the deck arrives without its title slide rather // than with a duplicated id. - let s = new_slide(&mut p, first_layout); - debug_assert!(s.is_some(), "a fresh deck cannot run out of ids"); - p.slides.extend(s.map(|s| vec![Arc::new(s)]).unwrap_or_default()); + if let Some(s) = new_slide(&mut p, first_layout) { + p.slides.push(Arc::new(s)); + } } p }