Shapes: shape.circleThroughPoints refuses a null anchors

This commit is contained in:
dotCooCoo
2026-11-17 18:09:52 -08:00
parent 8af2a300e6
commit e144392bec
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ fn circle_through_points(s: &mut Session, p: &Value) -> Result<Value> {
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"))),
+1 -1
View File
@@ -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}");
}