Fix integer underflow in Index Points node (#3623)
Fix: Prevent integer underflow in Index Points node
This commit is contained in:
parent
5dd11bf138
commit
479688d86b
|
|
@ -2275,6 +2275,9 @@ async fn index_points(
|
||||||
) -> DVec2 {
|
) -> DVec2 {
|
||||||
let points_count = content.iter().map(|row| row.element.point_domain.positions().len()).sum::<usize>();
|
let points_count = content.iter().map(|row| row.element.point_domain.positions().len()).sum::<usize>();
|
||||||
|
|
||||||
|
if points_count == 0 {
|
||||||
|
return DVec2::ZERO;
|
||||||
|
}
|
||||||
// Clamp and allow negative indexing from the end
|
// Clamp and allow negative indexing from the end
|
||||||
let index = index as isize;
|
let index = index as isize;
|
||||||
let index = if index < 0 {
|
let index = if index < 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue