From 2369fcc92d161f6fd155a4c3e520113ea88f6ea5 Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 18 Sep 2022 16:41:01 -0400 Subject: [PATCH] Fix unnecesary failure condition for chapter bar creation --- src/js-components/previewBar.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index c37a0c57..3d83890a 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -322,8 +322,7 @@ class PreviewBar { if (segments.every((segments) => segments.source === SponsorSourceType.YouTube) || (!Config.config.renderSegmentsAsChapters && segments.every((segment) => segment.actionType !== ActionType.Chapter - || segment.source === SponsorSourceType.YouTube)) - || this.chapterGroups?.length <= 0) { + || segment.source === SponsorSourceType.YouTube))) { if (this.customChaptersBar) this.customChaptersBar.style.display = "none"; this.originalChapterBar.style.removeProperty("display"); return; @@ -349,6 +348,12 @@ class PreviewBar { this.chapterGroups = this.unfilteredChapterGroups; } + if (!this.chapterGroups || this.chapterGroups.length <= 0) { + if (this.customChaptersBar) this.customChaptersBar.style.display = "none"; + this.originalChapterBar.style.removeProperty("display"); + return; + } + // Create it from cloning let createFromScratch = false; if (!this.customChaptersBar || !this.progressBar.contains(this.customChaptersBar)) {