aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-15 06:19:57 +0100
committerKim Alvefur <zash@zash.se>2018-03-15 06:19:57 +0100
commit58f5a8c2f04861b0ff7c98061769b1b46998b7ac (patch)
tree5d3d8863c12abdfbdda637659991187083bc6aca
parent15834a1d1c7dd5307b6340747a5adcef84252d87 (diff)
downloadprosody-58f5a8c2f04861b0ff7c98061769b1b46998b7ac.tar.gz
prosody-58f5a8c2f04861b0ff7c98061769b1b46998b7ac.zip
MUC: Catch and log error in case of storage failure in iterator over rooms
-rw-r--r--plugins/muc/mod_muc.lua10
1 files changed, 9 insertions, 1 deletions
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