Skip to content

Commit 766ab31

Browse files
committed
Fix: Prevent integer underflow in Index Points node
1 parent 1b91198 commit 766ab31

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

node-graph/nodes/vector/src/vector_nodes.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,9 @@ async fn index_points(
22752275
) -> DVec2 {
22762276
let points_count = content.iter().map(|row| row.element.point_domain.positions().len()).sum::<usize>();
22772277

2278+
if points_count == 0 {
2279+
return DVec2::ZERO;
2280+
}
22782281
// Clamp and allow negative indexing from the end
22792282
let index = index as isize;
22802283
let index = if index < 0 {

0 commit comments

Comments
 (0)