Fix:Overdrive chapter parser crash server on invalid meta data #880

This commit is contained in:
advplyr 2022-08-01 18:28:56 -05:00
parent fddf850a41
commit 95ac74d748
2 changed files with 23 additions and 9 deletions

View file

@ -402,9 +402,12 @@ class Book {
var includedAudioFiles = this.audioFiles.filter(af => !af.exclude)
// If overdrive media markers are present and preferred, use those instead
if (preferOverdriveMediaMarker && overdriveMediaMarkersExist(includedAudioFiles)) {
Logger.info('[Book] Overdrive Media Markers and preference found! Using these for chapter definitions')
return this.chapters = parseOverdriveMediaMarkersAsChapters(includedAudioFiles)
if (preferOverdriveMediaMarker) {
var overdriveChapters = parseOverdriveMediaMarkersAsChapters(includedAudioFiles)
if (overdriveChapters) {
Logger.info('[Book] Overdrive Media Markers and preference found! Using these for chapter definitions')
return this.chapters = overdriveChapters
}
}
if (includedAudioFiles.length === 1) {