]> source.dussan.org Git - sonarqube.git/commitdiff
Ensure component in not null on an issue location to prevent NPE at runtime
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 12 Oct 2016 12:53:07 +0000 (14:53 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 18 Oct 2016 14:00:26 +0000 (16:00 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java

index 2ee5cc74ab485ed26ac3c0f5d6cb4b5d6f6e56d0..ec123e4df969b655f87d58ce66c4f55ff3ce09d6 100644 (file)
@@ -100,6 +100,7 @@ public class DefaultIssue extends DefaultStorable implements Issue, NewIssue {
     Preconditions.checkArgument(primaryLocation != null, "Cannot use a location that is null");
     Preconditions.checkState(this.primaryLocation == null, "at() already called");
     this.primaryLocation = (DefaultIssueLocation) primaryLocation;
+    Preconditions.checkArgument(this.primaryLocation.inputComponent() != null, "Cannot use a location with no input component");
     return this;
   }