Przeglądaj źródła

fix(JitsiConference): fix crash on this.room if the room was disposed

dev1
paweldomas 9 lat temu
rodzic
commit
c9c482f43f
2 zmienionych plików z 7 dodań i 3 usunięć
  1. 4
    2
      JitsiConference.js
  2. 3
    1
      modules/xmpp/ChatRoom.js

+ 4
- 2
JitsiConference.js Wyświetl plik

@@ -1298,10 +1298,12 @@ JitsiConference.prototype.sendApplicationLog = function(message) {
1298 1298
  * Checks if the user identified by given <tt>mucJid</tt> is the conference
1299 1299
  * focus.
1300 1300
  * @param mucJid the full MUC address of the user to be checked.
1301
- * @returns {boolean} <tt>true</tt> if MUC user is the conference focus.
1301
+ * @returns {boolean|null} <tt>true</tt> if MUC user is the conference focus,
1302
+ * <tt>false</tt> when is not. <tt>null</tt> if we're not in the MUC anymore and
1303
+ * are unable to figure out the status or if given <tt>mucJid</tt> is invalid.
1302 1304
  */
1303 1305
 JitsiConference.prototype._isFocus = function (mucJid) {
1304
-    return this.room.isFocus(mucJid);
1306
+    return this.room ? this.room.isFocus(mucJid) : null;
1305 1307
 };
1306 1308
 
1307 1309
 /**

+ 3
- 1
modules/xmpp/ChatRoom.js Wyświetl plik

@@ -669,7 +669,9 @@ ChatRoom.prototype.removePresenceListener = function (name) {
669 669
  * Checks if the user identified by given <tt>mucJid</tt> is the conference
670 670
  * focus.
671 671
  * @param mucJid the full MUC address of the user to be checked.
672
- * @returns {boolean} <tt>true</tt> if MUC user is the conference focus.
672
+ * @returns {boolean|null} <tt>true</tt> if MUC user is the conference focus or
673
+ * <tt>false</tt> if is not. When given <tt>mucJid</tt> does not exist in
674
+ * the MUC then <tt>null</tt> is returned.
673 675
  */
674 676
 ChatRoom.prototype.isFocus = function (mucJid) {
675 677
     var member = this.members[mucJid];

Ładowanie…
Anuluj
Zapisz