# HG changeset patch # User Kim Alvefur # Date 1696782074 -7200 # Node ID e77994e889401937bf5ef5058761c77955b09d90 # Parent 9a86e7cbdd79513a21f769acf7adaf10840dec63 mod_storage_internal: Don't report error when attempting to trim empty archive Fixes "Could not delete messages for room 'x': (nil)" diff -r 9a86e7cbdd79 -r e77994e88940 plugins/mod_storage_internal.lua --- a/plugins/mod_storage_internal.lua Sun Sep 24 13:41:54 2023 +0200 +++ b/plugins/mod_storage_internal.lua Sun Oct 08 18:21:14 2023 +0200 @@ -346,7 +346,13 @@ 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);