Fix possible NPE

This commit is contained in:
Guillaume Nodet 2023-06-16 13:38:35 +02:00
parent bf6b0387a9
commit 45721a4c9b
1 changed files with 2 additions and 2 deletions

View File

@ -337,9 +337,9 @@ public class ExecutionEventLogger extends AbstractExecutionListener {
File currentPom = project.getFile(); File currentPom = project.getFile();
if (currentPom != null) { if (currentPom != null) {
MavenSession session = event.getSession(); MavenSession session = event.getSession();
Path topDirectory = session.getTopDirectory();
Path current = currentPom.toPath().toAbsolutePath().normalize(); Path current = currentPom.toPath().toAbsolutePath().normalize();
if (current.startsWith(topDirectory)) { Path topDirectory = session.getTopDirectory();
if (topDirectory != null && current.startsWith(topDirectory)) {
current = topDirectory.relativize(current); current = topDirectory.relativize(current);
} }
logger.info(" from " + current); logger.info(" from " + current);