Skip to content

Commit 8fd4fc2

Browse files
committed
Handle null paths
1 parent 8e543c4 commit 8fd4fc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/fabric8/maven/Maven.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static void writeModel(Model model, Path pom) {
124124
* @param writer the writer to write the model to
125125
*/
126126
public static void writeModel(Model model, Writer writer) {
127-
writeModel(model, model.getPomFile().toPath(), () -> writer);
127+
writeModel(model, model.getPomFile() != null ? model.getPomFile().toPath() : null, () -> writer);
128128
}
129129

130130
/**
@@ -146,7 +146,7 @@ public static void writeModel(Model model, Path pom, Writer writer) {
146146
* @param writerSupplier the writer supplier to write the model to
147147
*/
148148
public static void writeModel(Model model, Path pom, Supplier<Writer> writerSupplier) {
149-
if (pom.toFile().length() == 0L) {
149+
if (pom == null || pom.toFile().length() == 0L) {
150150
// Initialize an empty XML
151151
try (Writer writer = writerSupplier.get()) {
152152
MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer();

0 commit comments

Comments
 (0)