Changeset

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
parents 8142:13e075549cb3
children 8144:8e9a36d0c7d1
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	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)