Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad index in removevalues #571

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Conversation

billfreist
Copy link
Contributor

When the table.remove call from split into its own reverse iterating loop, the table.remove call was still using the k variable from the old loop rather than the new i index.

When the table.remove call from split into its own reverse iterating loop, the table.remove call was still using the `k` variable from the old loop rather than the new `i` index.
To match previous behavior, which was correct, the reverse iteration should also `break` so it doesn't needlessly try to match the entry that shifted into that index. No behavior change, as that entry would have already been checked and not matched.

If the table only has one entry that is removed, this code would be indexing an empty table.
Run embed to inject fixes to removevalues
@bkaradzic bkaradzic merged commit 0d54b85 into bkaradzic:master Nov 6, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants