1
0
Fork 0

Merge pull request 'Protect on_pick_up against unsafe usage' (#2835) from fix_unsafe_on_pick_up into master

Reviewed-on: MineClone2/MineClone2#2835
This commit is contained in:
cora 2022-10-23 13:58:21 +00:00
commit bffa214c77
1 changed files with 2 additions and 2 deletions

View File

@ -3134,9 +3134,9 @@ local function check_item_pickup(self)
for k,v in pairs(self.pick_up) do for k,v in pairs(self.pick_up) do
if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then
local r = self.on_pick_up(self,l) local r = self.on_pick_up(self,l)
if r and r:get_count() > 0 then if r and r.is_empty and not r:is_empty() then
l.itemstring = r:to_string() l.itemstring = r:to_string()
else elseif r and r.is_empty and r:is_empty() then
o:remove() o:remove()
end end
end end