Diff

plugins/mod_storage_internal.lua @ 8143:c4c159953c72

mod_storage_internal: Handle case of empty item store when deleting (fixes #910)
author Kim Alvefur <zash@zash.se>
date Sun, 14 May 2017 17:31:50 +0200
parent 8142:13e075549cb3
child 8173:3ff99d49082f
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua	Sun May 14 17:22:33 2017 +0200
+++ b/plugins/mod_storage_internal.lua	Sun May 14 17:31:50 2017 +0200
@@ -139,7 +139,13 @@
 		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)