From 7c1789a7c24c202366a62736bba7f509aef9ab64 Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 28 Oct 2021 06:35:22 -0500 Subject: [PATCH] Fix: filter out invalid bookmarks --- server/objects/AudiobookProgress.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/objects/AudiobookProgress.js b/server/objects/AudiobookProgress.js index a9ed85f0..9a119f3b 100644 --- a/server/objects/AudiobookProgress.js +++ b/server/objects/AudiobookProgress.js @@ -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() {