[mcl_buckets] Check whether node is nil for fishbuckets

Fixes #3913
This commit is contained in:
1F616EMO 2023-09-11 20:23:10 +08:00
parent b4c693bb20
commit 3d83315449
Signed by: Emojigit
GPG Key ID: EF52EFA8E05859B2
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ local function on_place_fish(itemstack, placer, pointed_thing)
local pos = pointed_thing.above or pointed_thing.under local pos = pointed_thing.above or pointed_thing.under
if not pos then return end if not pos then return end
local n = minetest.get_node_or_nil(pos) local n = minetest.get_node_or_nil(pos)
if n.name and minetest.registered_nodes[n.name].buildable_to or n.name == "mcl_portals:portal" then if n and n.name and minetest.registered_nodes[n.name].buildable_to or n.name == "mcl_portals:portal" then
local fish = itemstack:get_name():gsub(fishbucket_prefix,"") local fish = itemstack:get_name():gsub(fishbucket_prefix,"")
if fish_names[fish] then if fish_names[fish] then
local o = minetest.add_entity(pos, "mobs_mc:" .. fish) local o = minetest.add_entity(pos, "mobs_mc:" .. fish)