forked from minetest-mods/xban2
Fix crash trying to format nil as string.
Reported by CWz.
This commit is contained in:
parent
2b51822b3e
commit
51097eee6b
10
init.lua
10
init.lua
@ -222,12 +222,11 @@ end
|
|||||||
|
|
||||||
local function save_db()
|
local function save_db()
|
||||||
minetest.after(SAVE_INTERVAL, save_db)
|
minetest.after(SAVE_INTERVAL, save_db)
|
||||||
local ok
|
|
||||||
local f, e = io.open(DB_FILENAME, "wt")
|
local f, e = io.open(DB_FILENAME, "wt")
|
||||||
db.timestamp = os.time()
|
db.timestamp = os.time()
|
||||||
if f then
|
if f then
|
||||||
ok, e = f:write(xban.serialize(db))
|
local ok = f:write(xban.serialize(db))
|
||||||
WARNING("Unable to save database: %s", e)
|
WARNING("Unable to save database: %s", "Write failed")
|
||||||
end
|
end
|
||||||
if f then f:close() end
|
if f then f:close() end
|
||||||
return
|
return
|
||||||
@ -239,10 +238,9 @@ local function load_db()
|
|||||||
WARNING("Unable to load database: %s", e)
|
WARNING("Unable to load database: %s", e)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local cont
|
local cont = f:read("*a")
|
||||||
cont, e = f:read("*a")
|
|
||||||
if not cont then
|
if not cont then
|
||||||
WARNING("Unable to load database: %s", e)
|
WARNING("Unable to load database: %s", "Read failed")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local t = minetest.deserialize(cont)
|
local t = minetest.deserialize(cont)
|
||||||
|
Loading…
Reference in New Issue
Block a user