]> source.dussan.org Git - sonarqube.git/commitdiff
Temporarily fix NPE in api/issues/search
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 13 Jul 2016 14:06:28 +0000 (16:06 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 13 Jul 2016 14:06:28 +0000 (16:06 +0200)
when a project or module is not found (probably
on closed issues)

server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java

index e9385a5c47d32ff33a03da9afc970937ecaa4b3a..84e5aeb2ded07c3b60ba8509dcb28cd586f8ad33 100644 (file)
@@ -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());
       }