diff --git a/crates/engine/src/cmd/create.rs b/crates/engine/src/cmd/create.rs index 61b22d12b9..dc28eef546 100644 --- a/crates/engine/src/cmd/create.rs +++ b/crates/engine/src/cmd/create.rs @@ -425,7 +425,7 @@ fn circle_through_points(s: &mut Session, p: &Value) -> Result { None => selected_anchor_points(s)?.ok_or_else(|| bad(C, "direct-select two or three anchor points, or give `points`"))?, }; let key = "anchors"; - let at_points = match p.get(key).filter(|v| !v.is_null()).map(Value::as_str) { + let at_points = match p.get(key).map(Value::as_str) { None | Some(Some("standard")) => false, Some(Some("points")) => true, Some(_) => return Err(bad(C, format!("`{key}` must be one of {}", "standard, points"))), diff --git a/crates/engine/src/tests/circle_through.rs b/crates/engine/src/tests/circle_through.rs index a6f69d1bea..c9b66f9f06 100644 --- a/crates/engine/src/tests/circle_through.rs +++ b/crates/engine/src/tests/circle_through.rs @@ -226,7 +226,7 @@ fn anchors_at_the_points_puts_an_anchor_at_each_point() { assert_eq!(anchors.len(), 4, "{anchors:?}"); assert_eq!((anchors[0], anchors[2]), (Point::new(0.0, 0.0), Point::new(100.0, 0.0))); let (count, undo) = (object_count(&s), undo_len(&s)); - for bad in [json!("corners"), json!(true), json!(4)] { + for bad in [json!("corners"), json!(true), json!(4), Value::Null] { let e = s.execute(C, &json!({ "points": [[0, 0], [100, 0]], "anchors": bad })).unwrap_err().to_string(); assert!(e.contains("`anchors` must be one of standard, points"), "{e}"); }