storagemanager: Fix saving data in map shim when no prior data exists
authorKim Alvefur <zash@zash.se>
Sun, 6 Mar 2016 17:51:11 +0000 (18:51 +0100)
committerKim Alvefur <zash@zash.se>
Sun, 6 Mar 2016 17:51:11 +0000 (18:51 +0100)
core/storagemanager.lua

index 4f04e594b4ee752143f610354473518d8a18af43..680b65ad526753637d52c12c302452ffc125a919 100644 (file)
@@ -123,14 +123,12 @@ local map_shim_mt = {
                        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;