From d83aaabab756bbddf527641e7e02e48ab79da4f9 Mon Sep 17 00:00:00 2001 From: Misthaa Date: Thu, 21 Nov 2024 15:04:48 +0100 Subject: [PATCH] Fix with try/catch --- .../nginx/static/javascript/lobbyPage/main.js | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js index 92d9a72..086e1c4 100644 --- a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js +++ b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js @@ -143,13 +143,19 @@ function searchUser(event) function ajustSearchUserList() { - const searchInputUser = document.getElementById('searchInputUser'); - const pos = searchInputUser.getBoundingClientRect(); - const searchResult = document.getElementById('searchResult'); + try { + const searchInputUser = document.getElementById('searchInputUser'); + const pos = searchInputUser.getBoundingClientRect(); + const searchResult = document.getElementById('searchResult'); + + searchResult.style.width = pos.width + 'px'; + searchResult.style.top = pos.top + pos.height + 'px'; + searchResult.style.left = pos.left + 'px'; + } + catch { + // Do nothing + } - searchResult.style.width = pos.width + 'px'; - searchResult.style.top = pos.top + pos.height + 'px'; - searchResult.style.left = pos.left + 'px'; } function goBackHome() @@ -380,12 +386,16 @@ function selectGameModeFour(event, disableScroll = false) function movePopMenuLoginButton() { - const loginButton = document.getElementById('loginButton'); - const pos = loginButton.getBoundingClientRect(); - const popMenuLoginButton = document.getElementById('popMenuLoginButton'); + try { + const loginButton = document.getElementById('loginButton'); + const pos = loginButton.getBoundingClientRect(); + const popMenuLoginButton = document.getElementById('popMenuLoginButton'); - popMenuLoginButton.style.left = pos.left + "px"; - popMenuLoginButton.style.top = pos.top + pos.height + "px"; + popMenuLoginButton.style.left = pos.left + "px"; + popMenuLoginButton.style.top = pos.top + pos.height + "px"; + } catch { + // Do nothing + } } function showMenu()