Skip to content

Commit

Permalink
Fix crash whem matching near spawnpoint with Zuma generation
Browse files Browse the repository at this point in the history
One of the checks would fetch the previous group's last sphere, but that group could have no spheres due to it being a generator group. This would cause a crash.
  • Loading branch information
jakubg1 committed Aug 9, 2024
1 parent 30b738a commit e5ba957
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SphereGroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ function SphereGroup:shouldMatch(position)
end
if self.config.permitLongMatches then
-- if is magnetizing with previous group and we want to maximize the count of spheres
if self.prevGroup and not self.prevGroup.delQueue and _Game.session:colorsMatch(self.prevGroup:getLastSphere().color, self.spheres[1].color) and position1 == 1 then
-- We are doing a check whether that previous group is empty. It CAN be empty, if the Zuma sphere generation is enabled.
if self.prevGroup and not #self.prevGroup.spheres == 0 and not self.prevGroup.delQueue and _Game.session:colorsMatch(self.prevGroup:getLastSphere().color, self.spheres[1].color) and position1 == 1 then
return false
end
-- same check with the next group
Expand Down

0 comments on commit e5ba957

Please sign in to comment.