Correct variable == nil crashes.
This commit is contained in:
parent
82f226a0aa
commit
a0fac75def
1 changed files with 4 additions and 2 deletions
|
@ -326,7 +326,7 @@ local function translocate(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local id = meta:get_string('id')
|
local id = meta:get_string('id')
|
||||||
local pair = fun_caves.db.translocators[tonumber(id)]
|
local pair = fun_caves.db.translocators[tonumber(id)]
|
||||||
if #pair < 2 then
|
if not pair or #pair < 2 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local pos2
|
local pos2
|
||||||
|
@ -376,11 +376,13 @@ local function trans_dig(pos, node, digger)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local id = meta:get_string('id')
|
local id = meta:get_string('id')
|
||||||
local data = { id = id }
|
local data = { id = id }
|
||||||
|
if not (data and data.id) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local pair = fun_caves.db.translocators[tonumber(data.id)]
|
local pair = fun_caves.db.translocators[tonumber(data.id)]
|
||||||
if #pair < 1 then
|
if #pair < 1 then
|
||||||
print('* Fun Caves: low error in translocator storage')
|
print('* Fun Caves: low error in translocator storage')
|
||||||
end
|
end
|
||||||
print(minetest.serialize(pair[1]), minetest.serialize(pos))
|
|
||||||
local inv = digger:get_inventory()
|
local inv = digger:get_inventory()
|
||||||
local item = ItemStack(node.name)
|
local item = ItemStack(node.name)
|
||||||
local data_str = minetest.serialize(data)
|
local data_str = minetest.serialize(data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue