Skip to content

Commit 79d97eb

Browse files
fix(rendering): hang caused by out of order points within decimation code
Signed-off-by: Maika Namuo <httpworldview@gmail.com>
1 parent 223ac88 commit 79d97eb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/visuals/render/common.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ pub fn decimate_line_in_place(pts: &mut Vec<(f32, f32)>, max_points: usize) {
321321
return;
322322
}
323323

324-
debug_assert!(pts.windows(2).all(|w| w[0].0 <= w[1].0));
324+
if pts.windows(2).any(|w| w[0].0 > w[1].0) {
325+
pts.sort_by(|a, b| a.0.total_cmp(&b.0));
326+
}
325327
let Some(&last) = pts.last() else { return };
326328
let (x0, width) = (pts[0].0, last.0 - pts[0].0);
327329
let bucketed = width.is_finite() && width > 0.0;

0 commit comments

Comments
 (0)