Navigation Menu

Skip to content

Commit

Permalink
Ignore null reporters field and avoid a NPE.
Browse files Browse the repository at this point in the history
The NPE can occur if a build fails during checkout and hence the run phase
never gets called. See JENKINS-10831 for an example of this happening.
(cherry picked from commit 2fa4018)
  • Loading branch information
oldelvet authored and vjuranek committed Feb 2, 2012
1 parent bafad70 commit d630404
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions maven-plugin/src/main/java/hudson/maven/MavenBuild.java
Expand Up @@ -752,8 +752,11 @@ listener,new ProxyImpl(),
}

public void post2(BuildListener listener) throws Exception {
for (MavenReporter reporter : reporters)
reporter.end(MavenBuild.this,launcher,listener);
if (reporters != null) {
for (MavenReporter reporter : reporters) {
reporter.end(MavenBuild.this,launcher,listener);
}
}
}

}
Expand Down

0 comments on commit d630404

Please sign in to comment.