fix(path-type): NaN-safe bracket clamping (f64::clamp panics on a NaN path length)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-13 02:22:34 -04:00
co-authored by Claude Opus 5.5
parent f96895f400
commit b70b586a16
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -417,7 +417,7 @@ pub fn frame_specs(doc: &Document, sid: StoryId) -> Vec<FrameSpec> {
path: None,
..tf.options.clone()
};
let end = pt.end.map_or(len, |e| e.clamp(0.0, len));
let end = pt.end.map_or(len, |e| e.max(0.0).min(len));
(Rect::new(0.0, 0.0, (end - pt.start).max(1.0), size * 1.6), opts)
}
None => (item.text_area(), tf.options.clone()),
+1 -1
View File
@@ -97,7 +97,7 @@ fn path_options(s: &mut Session, p: &Value) -> Result<Value> {
return Ok(json!({"deleted": true}));
}
if let Some(v) = p.get("start").and_then(Value::as_f64).filter(|v| v.is_finite()) {
pt.start = v.clamp(0.0, len);
pt.start = v.max(0.0).min(len);
}
match p.get("end") {
Some(Value::Null) => pt.end = None,