mod_storage_xmlarchive/mod_storage_xmlarchive.lua
changeset 2044 459e1878d23c
parent 2042 a85b5c3791dc
child 2045 7c61ab512d0b
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue Feb 02 16:26:21 2016 +0100
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue Feb 02 16:27:38 2016 +0100
@@ -182,7 +182,11 @@
 	end
 	local before = query.before or query["end"] or "9999-12-31";
 	if type(before) == "number" then before = dt.date(before); else before = before:sub(1, 10); end
-	local dates = dm.list_load(username, module.host, self.store) or empty;
+	local dates, err = dm.list_load(username, module.host, self.store);
+	if not dates or next(dates) == nil then
+		if not err then return true end -- already empty
+		return dates, err;
+	end
 	local remaining_dates = {};
 	for d = 1, #dates do
 		if dates[d] >= before then