浏览代码

fix: ensure mucNickname

dev1
Giovanni Cascio 3 年前
父节点
当前提交
4ead244ec5
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      JitsiConference.js

+ 2
- 2
JitsiConference.js 查看文件

326
         // We try to use the first part of the node (which for anonymous users
326
         // We try to use the first part of the node (which for anonymous users
327
         // on prosody is a UUID) to match the previous behavior (and maybe make
327
         // on prosody is a UUID) to match the previous behavior (and maybe make
328
         // debugging easier).
328
         // debugging easier).
329
-        mucNickname = Strophe.getNodeFromJid(jid).substr(0, 8)
329
+        mucNickname = Strophe.getNodeFromJid(jid)?.substr(0, 8)
330
             .toLowerCase();
330
             .toLowerCase();
331
 
331
 
332
         // But if this doesn't have the required format we just generate a new
332
         // But if this doesn't have the required format we just generate a new
333
         // random nickname.
333
         // random nickname.
334
         const re = /[0-9a-f]{8}/g;
334
         const re = /[0-9a-f]{8}/g;
335
 
335
 
336
-        if (!re.test(mucNickname)) {
336
+        if (!mucNickname || !re.test(mucNickname)) {
337
             mucNickname = RandomUtil.randomHexString(8).toLowerCase();
337
             mucNickname = RandomUtil.randomHexString(8).toLowerCase();
338
         }
338
         }
339
     }
339
     }

正在加载...
取消
保存