SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
sketch.cut: refuse non-object params instead of panicking
bherbruck4097ac0131a5
diff --git a/crates/engine/src/cmd/sketch_clipboard.rs b/crates/engine/src/cmd/sketch_clipboard.rsindex 5818063cbf..b8036f933f 100644--- a/crates/engine/src/cmd/sketch_clipboard.rs+++ b/crates/engine/src/cmd/sketch_clipboard.rs@@ -209,8 +209,12 @@ fn copy(s: &mut Session, p: &Value) -> Result<Value> {}fn cut(s: &mut Session, p: &Value) -> Result<Value> {+ // `q["entities"] = …` below panics on anything but an object.+ if !(p.is_object() || p.is_null()) {+ return Err(bad("sketch.cut", "params must be an object"));+ }let entities = chosen(s, p);- let mut q = p.clone();+ let mut q = if p.is_null() { json!({}) } else { p.clone() };q["entities"] = json!(entities);let out = copy(s, &q)?;let delete = super::find_command("sketch.delete").ok_or_else(|| bad("sketch.cut", "sketch.delete is missing"))?;