fix(breakout-rooms): Adds few nil checks in lua code.

This commit is contained in:
Дамян Минков 2021-12-23 14:07:44 -06:00
parent 348414cc84
commit 04f9ad32e1
1 changed files with 7 additions and 3 deletions

View File

@ -213,7 +213,7 @@ end
function destroy_breakout_room(room_jid, message) function destroy_breakout_room(room_jid, message)
local main_room, main_room_jid = get_main_room(room_jid); local main_room, main_room_jid = get_main_room(room_jid);
if room_jid == main_room_jid then if room_jid == main_room_jid or not main_room then
return; return;
end end
@ -339,7 +339,7 @@ function on_occupant_joined(event)
local main_room = get_main_room(room.jid); local main_room = get_main_room(room.jid);
if main_room._data.breakout_rooms_active then if main_room and main_room._data.breakout_rooms_active then
if jid_node(event.occupant.jid) ~= 'focus' then if jid_node(event.occupant.jid) ~= 'focus' then
broadcast_breakout_rooms(room.jid); broadcast_breakout_rooms(room.jid);
end end
@ -388,6 +388,10 @@ function on_occupant_left(event)
local main_room = get_main_room(room_jid); local main_room = get_main_room(room_jid);
if not main_room then
return;
end
if main_room._data.breakout_rooms_active and jid_node(event.occupant.jid) ~= 'focus' then if main_room._data.breakout_rooms_active and jid_node(event.occupant.jid) ~= 'focus' then
broadcast_breakout_rooms(room_jid); broadcast_breakout_rooms(room_jid);
end end
@ -477,7 +481,7 @@ function process_breakout_rooms_muc_loaded(breakout_rooms_muc, host_module)
event.formdata['muc#roominfo_breakout_main_room'] = main_room_jid; event.formdata['muc#roominfo_breakout_main_room'] = main_room_jid;
-- If the main room has a lobby, make it so this breakout room also uses it. -- If the main room has a lobby, make it so this breakout room also uses it.
if (main_room._data.lobbyroom and main_room:get_members_only()) then if (main_room and main_room._data.lobbyroom and main_room:get_members_only()) then
table.insert(event.form, { table.insert(event.form, {
name = 'muc#roominfo_lobbyroom'; name = 'muc#roominfo_lobbyroom';
label = 'Lobby room jid'; label = 'Lobby room jid';