Fix last imported chapter not displaying sometimes

This commit is contained in:
Ajay
2022-09-14 03:40:24 -04:00
parent 8054e3d8f2
commit 4a00f3398e
2 changed files with 1 additions and 4 deletions

View File

@@ -1044,7 +1044,7 @@ async function sponsorsLookup(keepOldSubmissions = true) {
function importExistingChapters(wait: boolean) {
if (!existingChaptersImported) {
GenericUtils.wait(() => video && getExistingChapters(sponsorVideoID, video.duration),
GenericUtils.wait(() => video?.duration && getExistingChapters(sponsorVideoID, video.duration),
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
if (!existingChaptersImported && chapters?.length > 0) {
sponsorTimes = (sponsorTimes ?? []).concat(...chapters).sort((a, b) => a.segment[0] - b.segment[0]);