Diff

plugins/mod_storage_internal.lua @ 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
parent 8143:c4c159953c72
child 8309:5281c479955a
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