Skip to content

Commit c7ac9ad

Browse files
committed
chore: stop update if element was not found
should fix an uncaught exception
1 parent 17c8f6d commit c7ac9ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/src/ts/test/test-ui.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,10 @@ export async function updateWordsInputPosition(initial = false): Promise<void> {
451451
const currentLanguage = await JSONData.getCurrentLanguage(Config.language);
452452
const isLanguageRTL = currentLanguage.rightToLeft;
453453

454-
const el = document.querySelector("#wordsInput") as HTMLElement;
454+
const el = document.querySelector<HTMLElement>("#wordsInput");
455+
456+
if (!el) return;
457+
455458
const activeWord =
456459
document.querySelectorAll<HTMLElement>("#words .word")[
457460
TestState.activeWordIndex - activeWordElementOffset

0 commit comments

Comments
 (0)