From 58f5a8c2f04861b0ff7c98061769b1b46998b7ac Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 15 Mar 2018 06:19:57 +0100 Subject: MUC: Catch and log error in case of storage failure in iterator over rooms --- plugins/muc/mod_muc.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index d9d8fa2e..979aed8c 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -230,7 +230,15 @@ function each_room(local_only) coroutine.yield(room); seen[room.jid] = true; end - for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do + local all_persistent_rooms, err = persistent_rooms_storage:get(nil); + if not all_persistent_rooms then + if err then + module:log("error", "Error loading list of persistent rooms, only rooms live in memory were iterated over"); + module:log("debug", "%s", debug.traceback(err)); + end + return nil; + end + for room_jid in pairs(all_persistent_rooms) do if not seen[room_jid] then local room = restore_room(room_jid); if room then -- cgit v1.2.3