Skip to content

Commit 9ea04c3

Browse files
committed
check for null parent
1 parent 4faeb50 commit 9ea04c3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.maven.model.DependencyManagement;
2626
import org.apache.maven.model.InputLocation;
2727
import org.apache.maven.model.InputSource;
28+
import org.apache.maven.model.Parent;
2829
import org.apache.maven.model.Plugin;
2930
import org.apache.maven.model.PluginExecution;
3031
import org.apache.maven.model.building.ModelProblem;
@@ -124,7 +125,12 @@ public static SourceLocation findLocation(MavenProject mavenProject, MojoExecuti
124125

125126
// Plugin/execution is specified in some parent pom
126127
SourceLocation causeLocation = getSourceLocation(inputLocation, elementName);
127-
inputLocation = mavenProject.getModel().getParent().getLocation(SELF);
128+
Parent mavenParent = mavenProject.getModel().getParent();
129+
if(mavenParent == null) {
130+
// parent location cannot be determined for participant-added parents
131+
return new SourceLocation(1, 1, 1, causeLocation);
132+
}
133+
inputLocation = mavenParent.getLocation(SELF);
128134
if(inputLocation == null) {
129135
// parent location cannot be determined for participant-added parents
130136
return new SourceLocation(1, 1, 1, causeLocation);

0 commit comments

Comments
 (0)