diff options
author | heavygale <mail@heavygale.de> | 2018-05-31 16:06:56 +0200 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-31 15:06:56 +0100 |
commit | 21e1ce6675b8e42dd14957e2a7110236c44a19f2 (patch) | |
tree | ce39079794c91f68554b9d18c0927db6172e1849 | |
parent | 0ae58ad0c3f99567d34320208d2ca5305d0d161d (diff) |
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.
-rw-r--r-- | api.lua | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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 |