aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_storage_internal.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua
index bde294b2..da562201 100644
--- a/plugins/mod_storage_internal.lua
+++ b/plugins/mod_storage_internal.lua
@@ -346,7 +346,13 @@ end
function archive:trim(username, to_when)
local list, err = datamanager.list_open(username, host, self.store);
- if not list then return list,err;end
+ if not list then
+ if err == nil then
+ module:log("debug", "store already empty, can't trim");
+ return 0;
+ end
+ return list, err;
+ end
-- shortcut: check if the last item should be trimmed, if so, drop the whole archive
local last = list[#list].when or datetime.parse(list[#list].attr.stamp);