diff plugins/mod_storage_internal.lua @ 8146:5c91fb62338e

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 17 May 2017 01:06:20 +0200
parents c4c159953c72
children 3ff99d49082f
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_storage_internal.lua	Wed May 17 01:06:20 2017 +0200
@@ -139,12 +139,19 @@
 		if k ~= "end" then return nil, "unsupported-query-field"; end
 	end
 	local items, err = datamanager.list_load(username, host, self.store);
-	if not items then return items, err; end
+	if not items then
+		if err then
+			return items, err;
+		end
+		-- Store is empty
+		return 0;
+	end
 	items = array(items);
+	local count_before = #items;
 	items:filter(function (item)
 		return item.when > query["end"];
 	end);
-	local count = #items;
+	local count = count_before - #items;
 	local ok, err = datamanager.list_store(username, host, self.store, items);
 	if not ok then return ok, err; end
 	return count;