From 29c6151fe3cde9fa5d4ad26f36613f12eba660a8 Mon Sep 17 00:00:00 2001 From: Ajay Date: Fri, 2 Sep 2022 01:27:01 -0400 Subject: [PATCH] Ensure channel id is defined before declaring it found --- src/content.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/content.ts b/src/content.ts index 97e6ca8d..0aa6e64d 100644 --- a/src/content.ts +++ b/src/content.ts @@ -2199,15 +2199,18 @@ function getSegmentsMessage(sponsorTimes: SponsorTime[]): string { function windowListenerHandler(event: MessageEvent): void { const data = event.data; - const dataType = data.type + const dataType = data.type; if (data.source !== "sponsorblock") return; if (dataType === "navigation") { sponsorVideoID = data.videoID; - pageType = data.pageType - channelIDInfo = { - id: data.channelID, - status: ChannelIDStatus.Found + pageType = data.pageType; + + if (data.channelID) { + channelIDInfo = { + id: data.channelID, + status: ChannelIDStatus.Found + }; } } else if (dataType === "ad") { if (isAdPlaying != data.playing) {