Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fix TypeError: undefined is not an object

Lyubo Marinove1056126e6c7
diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js
index 5c1f0746f9..6b4545e3e4 100644
--- a/modules/UI/side_pannels/chat/Chat.js
+++ b/modules/UI/side_pannels/chat/Chat.js
@@ -164,9 +164,7 @@ function resizeChatConversation() {
* @param id {string} input id
*/
function deferredFocus(id){
- setTimeout(function (){
- $(`#${id}`).focus();
- }, 400);
+ setTimeout(() => $(`#${id}`).focus(), 400);
}
/**
* Chat related user interface.
@@ -353,10 +351,17 @@ var Chat = {
* Scrolls chat to the bottom.
*/
scrollChatToBottom () {
- setTimeout(function () {
- $('#chatconversation').scrollTop(
- $('#chatconversation')[0].scrollHeight);
- }, 5);
+ setTimeout(
+ () => {
+ const chatconversation = $('#chatconversation');
+
+ // XXX Prevent TypeError: undefined is not an object when the
+ // Web browser does not support WebRTC (yet).
+ chatconversation.length > 0
+ && chatconversation.scrollTop(
+ chatconversation[0].scrollHeight);
+ },
+ 5);
}
};