From 7895b9d2c1c61cc20f932daabe872f00ca336212 Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 2 Jan 2022 22:44:15 -0500 Subject: [PATCH] Fix crash from preview bar not being defined yet --- src/content.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index c0045fb7..6836cb40 100644 --- a/src/content.ts +++ b/src/content.ts @@ -449,7 +449,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?: if (!video) return; if (currentTime === undefined || currentTime === null) currentTime = video.currentTime; - previewBar.updateChapterText(sponsorTimes, currentTime); + previewBar?.updateChapterText(sponsorTimes, currentTime); if (video.paused) return; if (videoMuted && !inMuteSegment(currentTime)) { @@ -630,7 +630,7 @@ function setupVideoListeners() { startSponsorSchedule(); } else { - previewBar.updateChapterText(sponsorTimes, video.currentTime); + previewBar?.updateChapterText(sponsorTimes, video.currentTime); } }); video.addEventListener('ratechange', () => startSponsorSchedule());