Changeset

8173:3ff99d49082f

mod_storage_internal: Return a noop iterator if archive is empty (fixes #920)
author Kim Alvefur <zash@zash.se>
date Wed, 05 Jul 2017 05:44:56 +0200
parents 8172:66e32c34250b
children 8174:260886554512
files plugins/mod_storage_internal.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua	Wed Jul 05 04:38:08 2017 +0200
+++ b/plugins/mod_storage_internal.lua	Wed Jul 05 05:44:56 2017 +0200
@@ -62,7 +62,13 @@
 
 function archive:find(username, query)
 	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;
+		else
+			return function () end, 0;
+		end
+	end
 	local count = #items;
 	local i = 0;
 	if query then