Fix null collection errors when processing PDFs, audiobooks, and physical books (#2817)

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2026-02-19 23:11:37 -07:00
committed by GitHub
co-authored by acx10
parent 303fb905d6
commit 9ace45a8ea
4 changed files with 298 additions and 1 deletions
@@ -61,7 +61,6 @@ public class BookMetadata {
private Instant coverUpdatedOn;
private Instant audiobookCoverUpdatedOn;
private Set<String> authors;
@Singular
private Set<String> categories;
private Set<String> moods;
private Set<String> tags;
@@ -126,6 +126,7 @@ public class BookCreatorService {
}
public void addCategoriesToBook(Set<String> categories, BookEntity bookEntity) {
if (categories == null || categories.isEmpty()) return;
if (bookEntity.getMetadata().getCategories() == null) {
bookEntity.getMetadata().setCategories(new HashSet<>());
}
@@ -137,6 +138,7 @@ public class BookCreatorService {
}
public void addAuthorsToBook(Set<String> authors, BookEntity bookEntity) {
if (authors == null || authors.isEmpty()) return;
if (bookEntity.getMetadata().getAuthors() == null) {
bookEntity.getMetadata().setAuthors(new HashSet<>());
}
@@ -149,6 +151,7 @@ public class BookCreatorService {
}
public void addMoodsToBook(Set<String> moods, BookEntity bookEntity) {
if (moods == null || moods.isEmpty()) return;
if (bookEntity.getMetadata().getMoods() == null) {
bookEntity.getMetadata().setMoods(new HashSet<>());
}
@@ -160,6 +163,7 @@ public class BookCreatorService {
}
public void addTagsToBook(Set<String> tags, BookEntity bookEntity) {
if (tags == null || tags.isEmpty()) return;
if (bookEntity.getMetadata().getTags() == null) {
bookEntity.getMetadata().setTags(new HashSet<>());
}