From 34070786626b9fd328a971c3b69f38d578ad0659 Mon Sep 17 00:00:00 2001 From: nscuro Date: Tue, 12 Nov 2024 18:11:46 +0100 Subject: [PATCH] Fix NullPointerException when fetching findings Fixes #4351 Signed-off-by: nscuro --- .../dependencytrack/persistence/FindingsQueryManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/dependencytrack/persistence/FindingsQueryManager.java b/src/main/java/org/dependencytrack/persistence/FindingsQueryManager.java index d56394f2d1..f2d604ccc0 100644 --- a/src/main/java/org/dependencytrack/persistence/FindingsQueryManager.java +++ b/src/main/java/org/dependencytrack/persistence/FindingsQueryManager.java @@ -328,8 +328,10 @@ public List getFindings(Project project, boolean includeSuppressed) { .forEach(metaComponent -> { final var search = new RepositoryMetaComponentSearch(metaComponent.getRepositoryType(), metaComponent.getNamespace(), metaComponent.getName()); final List affectedFindings = findingsByMetaComponentSearch.get(search); - for (final Finding finding : affectedFindings) { - finding.getComponent().put("latestVersion", metaComponent.getLatestVersion()); + if (affectedFindings != null) { + for (final Finding finding : affectedFindings) { + finding.getComponent().put("latestVersion", metaComponent.getLatestVersion()); + } } });