Diff

core/storagemanager.lua @ 7244:8c6943918279

storagemanager: Fix saving data in map shim when no prior data exists
author Kim Alvefur <zash@zash.se>
date Sun, 06 Mar 2016 18:51:11 +0100
parent 7152:ca64255bf7cd
child 7245:210d8329dc70
child 7325:7baf1b14defb
line wrap: on
line diff
--- a/core/storagemanager.lua	Sat Mar 05 23:42:01 2016 +0000
+++ b/core/storagemanager.lua	Sun Mar 06 18:51:11 2016 +0100
@@ -123,14 +123,12 @@
 			if current == nil then
 				if err then
 					return nil, err;
-				else
-					current = keydatas;
 				end
-			else
-				for k,v in pairs(keydatas) do
-					if v == self.remove then v = nil; end
-					current[k] = v;
-				end
+				current = {};
+			end
+			for k,v in pairs(keydatas) do
+				if v == self.remove then v = nil; end
+				current[k] = v;
 			end
 			return self.keyval_store:set(username, current);
 		end;