Fix crash when pushing pumpkin by piston

This commit is contained in:
Bu-Gee 2018-03-05 12:53:16 +01:00 committed by Wuzzy
parent 34333c6b54
commit 3ae8119498

View File

@ -214,11 +214,14 @@ function minetest.handle_node_drops(pos, drops, digger)
-- Check if node will yield its useful drop by the digger's tool -- Check if node will yield its useful drop by the digger's tool
local dug_node = minetest.get_node(pos) local dug_node = minetest.get_node(pos)
local tool = digger:get_wielded_item() local toolcaps
local toolcaps = tool:get_tool_capabilities() if digger ~= nil then
local tool = digger:get_wielded_item()
toolcaps = tool:get_tool_capabilities()
if not check_can_drop(dug_node.name, toolcaps) then if not check_can_drop(dug_node.name, toolcaps) then
return return
end
end end
--[[ Special node drops when dug by shears by reading _mcl_shears_drop --[[ Special node drops when dug by shears by reading _mcl_shears_drop
@ -228,7 +231,7 @@ function minetest.handle_node_drops(pos, drops, digger)
* table: Drop every itemstring in this table when dub by shears * table: Drop every itemstring in this table when dub by shears
]] ]]
local nodedef = minetest.registered_nodes[dug_node.name] local nodedef = minetest.registered_nodes[dug_node.name]
if toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
if nodedef._mcl_shears_drop == true then if nodedef._mcl_shears_drop == true then
drops = { dug_node.name } drops = { dug_node.name }
else else