Fix possible NPEs during tag binding

Fixes #4593

Signed-off-by: nscuro <nscuro@protonmail.com>
This commit is contained in:
nscuro 2025-01-28 11:47:02 +01:00
parent 57b5cc33fd
commit 761f849b69
No known key found for this signature in database
4 changed files with 35 additions and 8 deletions

View file

@ -1382,11 +1382,17 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
return callInTransaction(() -> {
boolean modified = false;
if (project.getTags() == null) {
project.setTags(new ArrayList<>());
}
if (!keepExisting) {
for (final Tag existingTag : project.getTags()) {
if (!tags.contains(existingTag)) {
project.getTags().remove(existingTag);
existingTag.getProjects().remove(project);
if (existingTag.getProjects() != null) {
existingTag.getProjects().remove(project);
}
modified = true;
}
}