From 63ef9b44c784fef42f43ffdf3db08fbf5f5be64a Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 5 Oct 2022 02:15:31 -0400 Subject: [PATCH] Make sure chapters are invalid if regex fails --- src/utils/pageUtils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/pageUtils.ts b/src/utils/pageUtils.ts index 9ab31328..d753752c 100644 --- a/src/utils/pageUtils.ts +++ b/src/utils/pageUtils.ts @@ -78,6 +78,7 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number): const description = link.querySelector("#details h4") as HTMLElement; if (timeElement && description?.innerText?.length > 0 && link.getAttribute("href")?.includes(currentVideoID)) { const time = GenericUtils.getFormattedTimeToSeconds(timeElement.innerText); + if (!time) return []; if (lastSegment) { lastSegment.segment[1] = time;