returning if word is undefined

This commit is contained in:
Miodec 2023-01-27 15:28:08 +01:00
parent 2abd0e69fe
commit 81afc92022

View file

@ -88,11 +88,12 @@ const debouncedEvent = debounce(250, async () => {
if (Config.tapeMode !== "off") {
TestUI.scrollTape();
} else {
const currentTop: number = Math.floor(
const word =
document.querySelectorAll<HTMLElement>("#words .word")[
TestUI.currentWordElementIndex - 1
].offsetTop
);
];
if (!word) return;
const currentTop: number = Math.floor(word.offsetTop);
TestUI.lineJump(currentTop);
}
}