From f9e270e4bed441905a93785c3bc0d3c47174b8d5 Mon Sep 17 00:00:00 2001 From: Richard Bateman Date: Thu, 27 Jun 2024 14:32:14 -0600 Subject: [PATCH] bug: if oldLibraryItem is null things crash --- server/scanner/LibraryScanner.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/scanner/LibraryScanner.js b/server/scanner/LibraryScanner.js index 8131300d..6d72e870 100644 --- a/server/scanner/LibraryScanner.js +++ b/server/scanner/LibraryScanner.js @@ -176,9 +176,11 @@ class LibraryScanner { // TODO: Temporary while using old model to socket emit const oldLibraryItem = await Database.libraryItemModel.getOldById(existingLibraryItem.id) - oldLibraryItem.isMissing = true - oldLibraryItem.updatedAt = Date.now() - oldLibraryItemsUpdated.push(oldLibraryItem) + if (oldLibraryItem) { + oldLibraryItem.isMissing = true + oldLibraryItem.updatedAt = Date.now() + oldLibraryItemsUpdated.push(oldLibraryItem) + } } } } else {