Fix: filter out invalid bookmarks

This commit is contained in:
advplyr 2021-10-28 06:35:22 -05:00
parent b6ae6d86fa
commit 7c1789a7c2

View File

@ -22,7 +22,13 @@ class AudiobookProgress {
bookmarksToJSON() {
if (!this.bookmarks) return []
return this.bookmarks.map(b => b.toJSON())
return this.bookmarks.filter((b) => {
if (!b.toJSON) {
Logger.error(`[AudiobookProgress] Invalid bookmark ${JSON.stringify(b)}`)
return false
}
return true
}).map(b => b.toJSON())
}
toJSON() {