Correct variable == nil crashes.

This commit is contained in:
Duane 2016-06-27 07:59:45 -05:00
parent 82f226a0aa
commit a0fac75def

View file

@ -326,7 +326,7 @@ local function translocate(pos, node, clicker, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local id = meta:get_string('id')
local pair = fun_caves.db.translocators[tonumber(id)]
if #pair < 2 then
if not pair or #pair < 2 then
return
end
local pos2
@ -376,11 +376,13 @@ local function trans_dig(pos, node, digger)
local meta = minetest.get_meta(pos)
local id = meta:get_string('id')
local data = { id = id }
if not (data and data.id) then
return
end
local pair = fun_caves.db.translocators[tonumber(data.id)]
if #pair < 1 then
print('* Fun Caves: low error in translocator storage')
end
print(minetest.serialize(pair[1]), minetest.serialize(pos))
local inv = digger:get_inventory()
local item = ItemStack(node.name)
local data_str = minetest.serialize(data)