Changeset

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
parents 7241:5e7797822f19
children 7245:210d8329dc70 7249:c49f69bb68f7
files core/storagemanager.lua
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
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;