From 3131f8565387b7b928a25535685cd7dd00942180 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sun, 4 Dec 2022 11:51:50 -0500 Subject: [PATCH] null check on sponsorblock response --- src/components/VideoPlayer/SponsorBlockTask.bs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/VideoPlayer/SponsorBlockTask.bs b/src/components/VideoPlayer/SponsorBlockTask.bs index d0f403b2..c05aef02 100644 --- a/src/components/VideoPlayer/SponsorBlockTask.bs +++ b/src/components/VideoPlayer/SponsorBlockTask.bs @@ -8,11 +8,13 @@ function TaskMain() barPath = invalid skipSegments = [] - for each segment in sponsorBlockResponse - if segment.videoDuration > 0 - skipSegments.push(segment) - end if - end for + if sponsorBlockResponse <> invalid + for each segment in sponsorBlockResponse + if segment.videoDuration > 0 + skipSegments.push(segment) + end if + end for + end if if skipSegments.Count() = 0 skipSegments = invalid