mirror of
https://gitlab.com/rubenwardy/awards.git
synced 2024-11-22 15:23:44 +01:00
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:
parent
0ae58ad0c3
commit
21e1ce6675
14
api.lua
14
api.lua
@ -51,12 +51,14 @@ local function convert_data()
|
||||
local ret = {}
|
||||
|
||||
local count = 0
|
||||
for modname, items in pairs(data[from]) do
|
||||
for itemname, value in pairs(items) do
|
||||
itemname = modname .. ":" .. itemname
|
||||
local key = minetest.registered_aliases[itemname] or itemname
|
||||
ret[key] = value
|
||||
count = count + value
|
||||
if data[from] then
|
||||
for modname, items in pairs(data[from]) do
|
||||
for itemname, value in pairs(items) do
|
||||
itemname = modname .. ":" .. itemname
|
||||
local key = minetest.registered_aliases[itemname] or itemname
|
||||
ret[key] = value
|
||||
count = count + value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user