Skip to content

Commit

Permalink
Fix 0/0 condition on faulty tool capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed May 2, 2021
1 parent 5b53183 commit b05a49a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cart_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
end

local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then
-- Faulty tool registrations may cause the interval to be set to 0 !
if tool_capabilities and (tool_capabilities.full_punch_interval or 0) > 0 then
punch_interval = tool_capabilities.full_punch_interval
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
Expand Down

0 comments on commit b05a49a

Please sign in to comment.