From 719010db976334cdefad436f36e6fc651895c901 Mon Sep 17 00:00:00 2001 From: Manual Date: Sat, 27 Mar 2021 00:08:02 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20throw=20an=20exception=20if=20t?= =?UTF-8?q?here=E2=80=99s=20no=20videoRoot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suggested change by @ajayyy Co-authored-by: Ajay Ramachandran --- src/content.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content.ts b/src/content.ts index 6bbbc46e..33842dd3 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1532,7 +1532,7 @@ function addHotkeyListener(): boolean { if (onInvidious) videoRoot = (document.getElementById("player-container") ?? document.getElementById("player")) as HTMLDivElement; if (video.baseURI.startsWith("https://www.youtube.com/tv#/")) videoRoot = document.querySelector("ytlr-watch-page") as HTMLDivElement; - if (!videoRootsWithEventListeners.includes(videoRoot)) { + if (videoRoot && !videoRootsWithEventListeners.includes(videoRoot)) { videoRoot.addEventListener("keydown", hotkeyListener); videoRootsWithEventListeners.push(videoRoot); return true;