From e686beae4d3834b64517540b98c622a029f2fd7b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 13 Jul 2016 16:06:28 +0200 Subject: [PATCH] Temporarily fix NPE in api/issues/search when a project or module is not found (probably on closed issues) --- .../org/sonar/server/issue/ws/SearchResponseFormat.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java index e9385a5c47d..84e5aeb2ded 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java @@ -323,9 +323,13 @@ public class SearchResponseFormat { // On a root project, parentProjectId is null but projectId is equal to itself, which make no sense. if (!uuid.equals(dto.getRootUuid())) { ComponentDto project = data.getComponentByUuid(dto.projectUuid()); - builder.setProjectId(project.getId()); + if (project != null) { + builder.setProjectId(project.getId()); + } ComponentDto subProject = data.getComponentByUuid(dto.getRootUuid()); - builder.setSubProjectId(subProject.getId()); + if (subProject != null) { + builder.setSubProjectId(subProject.getId()); + } } result.add(builder.build()); } -- 2.39.5