Fallback to zeros in timestamp editor

This commit is contained in:
ConfusedPolarBear 2022-07-18 01:15:33 -05:00
parent 4923d35c03
commit 790117bc37

View File

@ -492,21 +492,14 @@
const rightEpisode = selectEpisode2.options[selectEpisode2.selectedIndex]; const rightEpisode = selectEpisode2.options[selectEpisode2.selectedIndex];
// 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 = { let leftEpisodeIntro = await getJson("Episode/" + leftEpisode.value + "/IntroTimestamps/v1");
IntroStart: 0, if (!leftEpisodeIntro.hasOwnProperty("IntroStart")) {
IntroEnd: 0, leftEpisodeIntro = { IntroStart: 0, IntroEnd: 0 };
}; }
let rightEpisodeIntro = { let rightEpisodeIntro = await getJson("Episode/" + rightEpisode.value + "/IntroTimestamps/v1");
IntroStart: 0, if (!rightEpisodeIntro.hasOwnProperty("IntroStart")) {
IntroEnd: 0, rightEpisodeIntro = { IntroStart: 0, IntroEnd: 0 };
};
try {
leftEpisodeIntro = await getJson("Episode/" + leftEpisode.value + "/IntroTimestamps/v1");
rightEpisodeIntro = await getJson("Episode/" + rightEpisode.value + "/IntroTimestamps/v1");
} catch {
// Ignore the server provided intro and use the defaults from above
} }
// Update the editor for the first and second episodes // Update the editor for the first and second episodes