fix: avoid invalid transforms in repeat_array when count is 1#4237
Draft
Sanketjadhav31 wants to merge 1 commit into
Draft
fix: avoid invalid transforms in repeat_array when count is 1#4237Sanketjadhav31 wants to merge 1 commit into
Sanketjadhav31 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request modifies the repeat_array function in repeat_nodes.rs to ensure that the total calculation has a minimum value of 1.0 by using .max(1) on count - 1. This prevents potential division by zero or invalid calculations when count is 1. There are no review comments to evaluate.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While looking through the repeat nodes, I noticed that
repeat_arrayallowscount = 1, but the calculation uses(count - 1)as a denominator.When
countis 1, this results in a zero denominator and can produce invalid transform values during the angle and translation calculations.This change guards against that edge case by ensuring the denominator is at least 1.
Changes
count = 1count >= 2Testing
Reasoned through the
count = 1execution path and verified that the denominator can no longer become zero.