Skip to content

Commit 2d06c48

Browse files
authored
NPE in set-version when property is set (#198)
Fix NPE
1 parent 448394f commit 2d06c48

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

shared/src/main/java/eu/maveniverse/maven/toolbox/shared/internal/jdom/JDomPomEditor.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ public static void setProperty(Element project, String key, String value, boolea
5252
properties = new Element("properties", project.getNamespace());
5353
JDomUtils.addElement(properties, project);
5454
}
55-
Element property = properties.getChild(key, properties.getNamespace());
56-
if (upsert && property == null) {
57-
property = new Element(key, properties.getNamespace());
58-
JDomUtils.addElement(property, properties);
59-
}
60-
if (property != null) {
61-
property.setText(value);
55+
if (properties != null) {
56+
Element property = properties.getChild(key, properties.getNamespace());
57+
if (upsert && property == null) {
58+
property = new Element(key, properties.getNamespace());
59+
JDomUtils.addElement(property, properties);
60+
}
61+
if (property != null) {
62+
property.setText(value);
63+
}
6264
}
6365
}
6466
}

0 commit comments

Comments
 (0)