aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-10-05 02:15:31 -0400
committerAjay <[email protected]>2022-10-05 02:15:31 -0400
commit63ef9b44c784fef42f43ffdf3db08fbf5f5be64a (patch)
treec0b376745d53c1be2fd780e78c0d45f46b621ee5
parent36efe139ba2f689d3af0210cd3e1497bfb606e57 (diff)
downloadSponsorBlock-63ef9b44c784fef42f43ffdf3db08fbf5f5be64a.tar.gz
SponsorBlock-63ef9b44c784fef42f43ffdf3db08fbf5f5be64a.zip
Make sure chapters are invalid if regex fails
-rw-r--r--src/utils/pageUtils.ts1
1 files changed, 1 insertions, 0 deletions
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;