Skip to content

Commit 7a12d2c

Browse files
committed
Fix possible NPE
1 parent 68b0671 commit 7a12d2c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ private Model readParentLocally(
937937
if (parent.getGroupId() != null && (groupId == null || !groupId.equals(parent.getGroupId()))
938938
|| parent.getArtifactId() != null
939939
&& (artifactId == null || !artifactId.equals(parent.getArtifactId()))) {
940-
mismatchRelativePathAndGA(childModel, groupId, artifactId);
940+
mismatchRelativePathAndGA(childModel, parent, groupId, artifactId);
941941
return null;
942942
}
943943

@@ -976,8 +976,7 @@ private Model readParentLocally(
976976
return candidateModel;
977977
}
978978

979-
private void mismatchRelativePathAndGA(Model childModel, String groupId, String artifactId) {
980-
Parent parent = childModel.getParent();
979+
private void mismatchRelativePathAndGA(Model childModel, Parent parent, String groupId, String artifactId) {
981980
StringBuilder buffer = new StringBuilder(256);
982981
buffer.append("'parent.relativePath'");
983982
if (childModel != getRootModel()) {
@@ -1381,7 +1380,7 @@ Model doReadFileModel() throws ModelBuilderException {
13811380
.version(parentVersion)
13821381
.build());
13831382
} else {
1384-
mismatchRelativePathAndGA(model, parentGroupId, parentArtifactId);
1383+
mismatchRelativePathAndGA(model, parent, parentGroupId, parentArtifactId);
13851384
}
13861385
} else {
13871386
if (!MODEL_VERSION_4_0_0.equals(model.getModelVersion()) && path != null) {

0 commit comments

Comments
 (0)