Skip to content

Commit

Permalink
The for loop in removevalues should also break
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
billfreist authored Nov 6, 2024
1 parent 53465a8 commit 79a2f95
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/base/bake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
for _, pattern in ipairs(removes) do
if pattern == tbl[i] then
table.remove(tbl, i)
break
end
end
end
Expand Down

0 comments on commit 79a2f95

Please sign in to comment.