mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-10-19 16:03:19 +00:00
Fix possible NPEs during tag binding
Fixes #4593 Signed-off-by: nscuro <nscuro@protonmail.com>
This commit is contained in:
parent
57b5cc33fd
commit
761f849b69
4 changed files with 35 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue