From 5915b2de1fe027f21281960097ec7aff883a2fea Mon Sep 17 00:00:00 2001 From: indierusty Date: Sat, 28 Jun 2025 11:22:11 +0530 Subject: [PATCH] fix division by zero in 'Repeat' node impl when count is exactly one --- node-graph/gcore/src/vector/vector_nodes.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/node-graph/gcore/src/vector/vector_nodes.rs b/node-graph/gcore/src/vector/vector_nodes.rs index 4ddd6bb55..b54909ced 100644 --- a/node-graph/gcore/src/vector/vector_nodes.rs +++ b/node-graph/gcore/src/vector/vector_nodes.rs @@ -229,9 +229,13 @@ async fn repeat( let mut result_table = Instances::::default(); for index in 0..count { - let angle = index as f64 * angle / total; - let translation = index as f64 * direction / total; - let transform = DAffine2::from_angle(angle) * DAffine2::from_translation(translation); + let transform = if total == 0. { + DAffine2::IDENTITY + } else { + let angle = index as f64 * angle / total; + let translation = index as f64 * direction / total; + DAffine2::from_angle(angle) * DAffine2::from_translation(translation) + }; for instance in instance.instance_ref_iter() { let mut instance = instance.to_instance_cloned();