diff options
author | Manual <[email protected]> | 2021-03-27 00:08:02 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-27 00:08:02 +0200 |
commit | 719010db976334cdefad436f36e6fc651895c901 (patch) | |
tree | e9000d84e7fae8c8eb0a109cb502b5f5acbc51c9 | |
parent | 928c075416ee1ca9b710c9396be97a4a1117a753 (diff) | |
download | SponsorBlock-719010db976334cdefad436f36e6fc651895c901.tar.gz SponsorBlock-719010db976334cdefad436f36e6fc651895c901.zip |
Don’t throw an exception if there’s no videoRoot
Suggested change by @ajayyy
Co-authored-by: Ajay Ramachandran <[email protected]>
-rw-r--r-- | src/content.ts | 2 |
1 files changed, 1 insertions, 1 deletions
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; |