Fix convert_data crash when craft data is missing

Crash occurs when no data for "craft" is available in the old data, fixed with a additional check.
This commit is contained in:
heavygale 2018-05-31 16:06:56 +02:00 committed by rubenwardy
parent 0ae58ad0c3
commit 21e1ce6675

14
api.lua

@ -51,12 +51,14 @@ local function convert_data()
local ret = {} local ret = {}
local count = 0 local count = 0
for modname, items in pairs(data[from]) do if data[from] then
for itemname, value in pairs(items) do for modname, items in pairs(data[from]) do
itemname = modname .. ":" .. itemname for itemname, value in pairs(items) do
local key = minetest.registered_aliases[itemname] or itemname itemname = modname .. ":" .. itemname
ret[key] = value local key = minetest.registered_aliases[itemname] or itemname
count = count + value ret[key] = value
count = count + value
end
end end
end end