diff --git a/src/lib/server/db.ts b/src/lib/server/db.ts index 933149e..c2a140d 100644 --- a/src/lib/server/db.ts +++ b/src/lib/server/db.ts @@ -1037,6 +1037,12 @@ function getCachedThumbnail(thumbnailUrl: string): SongThumbnailImage[] | null { } function cacheThumbnail(thumbnailUrl: string, thumbnails: SongThumbnailImage[]) { + if (!thumbnails) { + // This usually means, that the data is being saved to cached, + // while the thumbnail generation is not finished yet + logger.debug('will not cache empty thumbnail list', thumbnailUrl); + return; + } const now = new Date().getTime(); const initialSize = thumbnailCache.size; if (initialSize >= maxThumbnailCacheSize) {