From a44ee913c44f30abd9fa700fe3befa6578ff36eb Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 5 Sep 2023 16:10:46 -0500 Subject: [PATCH] Fix crash on get recent series home page shelf endpoint --- server/utils/queries/libraryFilters.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/utils/queries/libraryFilters.js b/server/utils/queries/libraryFilters.js index 0ac5c219..febb79ca 100644 --- a/server/utils/queries/libraryFilters.js +++ b/server/utils/queries/libraryFilters.js @@ -265,12 +265,17 @@ module.exports = { }) }) oldSeries.books = s.bookSeries.map(bs => { - const libraryItem = bs.book.libraryItem.toJSON() + const libraryItem = bs.book.libraryItem?.toJSON() + if (!libraryItem) { + Logger.warn(`Book series book has no libraryItem`, bs, bs.book, 'series=', series) + return null + } + delete bs.book.libraryItem libraryItem.media = bs.book const oldLibraryItem = Database.libraryItemModel.getOldLibraryItem(libraryItem).toJSONMinified() return oldLibraryItem - }) + }).filter(b => b) allOldSeries.push(oldSeries) }