mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-29 14:01:07 +01:00
Fix Server crash (Issue ##3939)
Fixes the error of pointed_thing being nil (null) by first checking to see if it exists, and if not, exit the on_place call back.
This commit is contained in:
parent
b4c693bb20
commit
f57220f784
1 changed files with 5 additions and 1 deletions
|
@ -86,7 +86,7 @@ local bamboo_def = {
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node.
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
@ -277,6 +277,10 @@ local bamboo_block_def = {
|
||||||
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block.
|
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block.
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
|
if not pointed_thing then -- make sure that pointed_thing is not null
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
|
||||||
if mcl_bamboo.is_protected(pos, placer) then
|
if mcl_bamboo.is_protected(pos, placer) then
|
||||||
|
|
Loading…
Reference in a new issue