This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 45721a4c9 Fix possible NPE
45721a4c9 is described below

commit 45721a4c9b044b57f70a9608afe402051aeacd64
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Jun 16 13:38:35 2023 +0200

    Fix possible NPE
---
 .../main/java/org/apache/maven/cli/event/ExecutionEventLogger.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
 
b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index 26b4bcc53..947549360 100644
--- 
a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ 
b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -337,9 +337,9 @@ public class ExecutionEventLogger extends 
AbstractExecutionListener {
             File currentPom = project.getFile();
             if (currentPom != null) {
                 MavenSession session = event.getSession();
-                Path topDirectory = session.getTopDirectory();
                 Path current = 
currentPom.toPath().toAbsolutePath().normalize();
-                if (current.startsWith(topDirectory)) {
+                Path topDirectory = session.getTopDirectory();
+                if (topDirectory != null && current.startsWith(topDirectory)) {
                     current = topDirectory.relativize(current);
                 }
                 logger.info("  from " + current);

Reply via email to