leftEpisode and rightEpisodeIntro can be null

This commit is contained in:
Kilian von Pflugk 2024-03-18 21:10:24 +01:00
parent a98525ddaa
commit b8053a3911

View File

@ -616,13 +616,13 @@
var autoSkipNotificationText = document.querySelector("div#divAutoSkipNotificationText"); var autoSkipNotificationText = document.querySelector("div#divAutoSkipNotificationText");
async function autoSkipChanged() { async function autoSkipChanged() {
if (autoSkip.checked) { if (autoSkip.checked) {
skipFirstEpisode.style.display = 'unset'; skipFirstEpisode.style.display = 'unset';
autoSkipNotificationText.style.display = 'unset'; autoSkipNotificationText.style.display = 'unset';
} else { } else {
skipFirstEpisode.style.display = 'none'; skipFirstEpisode.style.display = 'none';
autoSkipNotificationText.style.display = 'none'; autoSkipNotificationText.style.display = 'none';
} }
} }
autoSkip.addEventListener("change", autoSkipChanged); autoSkip.addEventListener("change", autoSkipChanged);
@ -633,13 +633,13 @@
// prevent setting unavailable options // prevent setting unavailable options
async function persistSkipChanged() { async function persistSkipChanged() {
if (persistSkip.checked) { if (persistSkip.checked) {
showAdjustment.style.display = 'none'; showAdjustment.style.display = 'none';
hideAdjustment.style.display = 'none'; hideAdjustment.style.display = 'none';
} else { } else {
showAdjustment.style.display = 'unset'; showAdjustment.style.display = 'unset';
hideAdjustment.style.display = 'unset'; hideAdjustment.style.display = 'unset';
} }
} }
persistSkip.addEventListener("change", persistSkipChanged); persistSkip.addEventListener("change", persistSkipChanged);
@ -785,12 +785,12 @@
// Try to get the timestamps of each intro, falling back a default value of zero if no intro was found // Try to get the timestamps of each intro, falling back a default value of zero if no intro was found
let leftEpisodeIntro = await getJson("Episode/" + selectEpisode1.value + "/IntroTimestamps/v1"); let leftEpisodeIntro = await getJson("Episode/" + selectEpisode1.value + "/IntroTimestamps/v1");
if (!leftEpisodeIntro.hasOwnProperty("IntroStart")) { if (leftEpisodeIntro === null) {
leftEpisodeIntro = { IntroStart: 0, IntroEnd: 0 }; leftEpisodeIntro = { IntroStart: 0, IntroEnd: 0 };
} }
let rightEpisodeIntro = await getJson("Episode/" + selectEpisode2.value + "/IntroTimestamps/v1"); let rightEpisodeIntro = await getJson("Episode/" + selectEpisode2.value + "/IntroTimestamps/v1");
if (!rightEpisodeIntro.hasOwnProperty("IntroStart")) { if (rightEpisodeIntro === null) {
rightEpisodeIntro = { IntroStart: 0, IntroEnd: 0 }; rightEpisodeIntro = { IntroStart: 0, IntroEnd: 0 };
} }