forked from mtcontrib/awards
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
2
api.lua
2
api.lua
@ -51,6 +51,7 @@ local function convert_data()
|
|||||||
local ret = {}
|
local ret = {}
|
||||||
|
|
||||||
local count = 0
|
local count = 0
|
||||||
|
if data[from] then
|
||||||
for modname, items in pairs(data[from]) do
|
for modname, items in pairs(data[from]) do
|
||||||
for itemname, value in pairs(items) do
|
for itemname, value in pairs(items) do
|
||||||
itemname = modname .. ":" .. itemname
|
itemname = modname .. ":" .. itemname
|
||||||
@ -59,6 +60,7 @@ local function convert_data()
|
|||||||
count = count + value
|
count = count + value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ret.__total = count
|
ret.__total = count
|
||||||
data[from] = nil
|
data[from] = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user