From 4d5c9005ae24b71d69b483d5ca4c0d69224f072d Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Feb 2022 01:37:19 -0500 Subject: [PATCH] Fix stackoverflow --- src/content.ts | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/content.ts b/src/content.ts index 2f8deb40..33718929 100644 --- a/src/content.ts +++ b/src/content.ts @@ -509,22 +509,25 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?: if (incorrectVideoCheck(videoID, currentSkip)) return; forceVideoTime ||= video.currentTime; - if ((shouldSkip(currentSkip) || sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment)) - && forceVideoTime >= skipTime[0] && forceVideoTime < skipTime[1]) { - skipToTime({ - v: video, - skipTime, - skippingSegments, - openNotice: skipInfo.openNotice - }); - - if (utils.getCategorySelection(currentSkip.category)?.option === CategorySkipOption.ManualSkip - || currentSkip.actionType === ActionType.Mute) { - forcedSkipTime = skipTime[0] + 0.001; + if ((shouldSkip(currentSkip) || sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment))) { + if (forceVideoTime >= skipTime[0] && forceVideoTime < skipTime[1]) { + skipToTime({ + v: video, + skipTime, + skippingSegments, + openNotice: skipInfo.openNotice + }); + + if (utils.getCategorySelection(currentSkip.category)?.option === CategorySkipOption.ManualSkip + || currentSkip.actionType === ActionType.Mute) { + forcedSkipTime = skipTime[0] + 0.001; + } else { + forcedSkipTime = skipTime[1]; + forcedIncludeIntersectingSegments = true; + forcedIncludeNonIntersectingSegments = false; + } } else { - forcedSkipTime = skipTime[1]; - forcedIncludeIntersectingSegments = true; - forcedIncludeNonIntersectingSegments = false; + forcedSkipTime = forceVideoTime + 0.001; } }