From 51097eee6bb6179773e7df4c958c1dd80136ed42 Mon Sep 17 00:00:00 2001
From: Diego Martinez <kaeza@users.sf.net>
Date: Tue, 20 May 2014 12:56:07 -0300
Subject: Fix crash trying to format nil as string.

Reported by CWz.
---
 init.lua | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/init.lua b/init.lua
index 869d079..f255283 100644
--- a/init.lua
+++ b/init.lua
@@ -222,12 +222,11 @@ end
 
 local function save_db()
 	minetest.after(SAVE_INTERVAL, save_db)
-	local ok
 	local f, e = io.open(DB_FILENAME, "wt")
 	db.timestamp = os.time()
 	if f then
-		ok, e = f:write(xban.serialize(db))
-		WARNING("Unable to save database: %s", e)
+		local ok = f:write(xban.serialize(db))
+		WARNING("Unable to save database: %s", "Write failed")
 	end
 	if f then f:close() end
 	return
@@ -239,10 +238,9 @@ local function load_db()
 		WARNING("Unable to load database: %s", e)
 		return
 	end
-	local cont
-	cont, e = f:read("*a")
+	local cont = f:read("*a")
 	if not cont then
-		WARNING("Unable to load database: %s", e)
+		WARNING("Unable to load database: %s", "Read failed")
 		return
 	end
 	local t = minetest.deserialize(cont)
-- 
cgit v1.2.3