Merge pull request #2117 from Silvertree2010/fix/h11295-node-reparent-silently-turns-a-n

Reject negative or fractional index in node.reparent
This commit is contained in:
BFlat authored and GitHub committed 2026-11-12 09:20:42 +07:00
commit f2c593ff6e
2 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -245,7 +245,7 @@ pub(super) fn stroke_brush(s: &mut Session, p: &Value) -> Result<Value> {
pub(super) fn reparent(s: &mut Session, p: &Value) -> Result<Value> {
let ids = req_targets("node.reparent", s, p)?;
let parent = req_id("node.reparent", p, "parent")?;
let index = num(p, "index").map(|i| i.max(0.0) as usize);
let index = opt_index("node.reparent", p, "index")?;
let doc = s.doc_mut()?;
let ids = z_sorted(doc, &roots(doc, &ids));
// `index` is where the first moved layer ends up among the parent's children (bottom first),