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:
@@ -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<>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user