From d1d3cb0f65000c24e3e588c4f2958c75b86f9a4e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Wed, 23 Nov 2022 09:35:22 +0100 Subject: [PATCH] Fix possible NullPointerException --- .../src/main/java/org/apache/maven/cli/DaemonMavenCli.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java index c4fc9e26d..8108bb75f 100644 --- a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java +++ b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java @@ -714,7 +714,10 @@ private int execute(CliRequest cliRequest) throws MavenExecutionRequestPopulatio logSummary(summary, references, "", cliRequest.showErrors); if (exception instanceof LifecycleExecutionException) { - failedProjects.add(((LifecycleExecutionException) exception).getProject()); + MavenProject project = ((LifecycleExecutionException) exception).getProject(); + if (project != null) { + failedProjects.add(project); + } } }