Parcourir la source

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

master
Дамян Минков il y a 3 ans
Parent
révision
04f9ad32e1
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7
    3
      resources/prosody-plugins/mod_muc_breakout_rooms.lua

+ 7
- 3
resources/prosody-plugins/mod_muc_breakout_rooms.lua Voir le fichier

213
 function destroy_breakout_room(room_jid, message)
213
 function destroy_breakout_room(room_jid, message)
214
     local main_room, main_room_jid = get_main_room(room_jid);
214
     local main_room, main_room_jid = get_main_room(room_jid);
215
 
215
 
216
-    if room_jid == main_room_jid then
216
+    if room_jid == main_room_jid or not main_room then
217
         return;
217
         return;
218
     end
218
     end
219
 
219
 
339
 
339
 
340
     local main_room = get_main_room(room.jid);
340
     local main_room = get_main_room(room.jid);
341
 
341
 
342
-    if main_room._data.breakout_rooms_active then
342
+    if main_room and main_room._data.breakout_rooms_active then
343
         if jid_node(event.occupant.jid) ~= 'focus' then
343
         if jid_node(event.occupant.jid) ~= 'focus' then
344
             broadcast_breakout_rooms(room.jid);
344
             broadcast_breakout_rooms(room.jid);
345
         end
345
         end
388
 
388
 
389
     local main_room = get_main_room(room_jid);
389
     local main_room = get_main_room(room_jid);
390
 
390
 
391
+    if not main_room then
392
+        return;
393
+    end
394
+
391
     if main_room._data.breakout_rooms_active and jid_node(event.occupant.jid) ~= 'focus' then
395
     if main_room._data.breakout_rooms_active and jid_node(event.occupant.jid) ~= 'focus' then
392
         broadcast_breakout_rooms(room_jid);
396
         broadcast_breakout_rooms(room_jid);
393
     end
397
     end
477
         event.formdata['muc#roominfo_breakout_main_room'] = main_room_jid;
481
         event.formdata['muc#roominfo_breakout_main_room'] = main_room_jid;
478
 
482
 
479
         -- If the main room has a lobby, make it so this breakout room also uses it.
483
         -- If the main room has a lobby, make it so this breakout room also uses it.
480
-        if (main_room._data.lobbyroom and main_room:get_members_only()) then
484
+        if (main_room and main_room._data.lobbyroom and main_room:get_members_only()) then
481
             table.insert(event.form, {
485
             table.insert(event.form, {
482
                 name = 'muc#roominfo_lobbyroom';
486
                 name = 'muc#roominfo_lobbyroom';
483
                 label = 'Lobby room jid';
487
                 label = 'Lobby room jid';

Chargement…
Annuler
Enregistrer