Skip to content

Commit

Permalink
Fix JENKINS-22610
Browse files Browse the repository at this point in the history
Added check if the returned value from getTemplateById is null. Write
error to the build log if the template is missing.
  • Loading branch information
slide committed Apr 14, 2014
1 parent 3f2aece commit 7c9af27
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -48,7 +48,11 @@ public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
boolean result = true;
for(TemplateId template : templateIds) {
ExtendedEmailPublisherTemplate t = getDescriptor().getTemplateById(template.getTemplateId());
result &= t.getPublisher().prebuild(build, listener);
if(t != null) {
result &= t.getPublisher().prebuild(build, listener);
} else {
listener.getLogger().println("Template with ID " + template.getTemplateId() + " has been removed, please double check your settings");
}
}

return result;
Expand All @@ -61,6 +65,8 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
ExtendedEmailPublisherTemplate t = getDescriptor().getTemplateById(template.getTemplateId());
if(t != null) {
result &= t.getPublisher().perform(build, launcher, listener);
} else {
listener.getLogger().println("Template with ID " + template.getTemplateId() + " has been removed, please double check your settings");
}
}
return result;
Expand Down

0 comments on commit 7c9af27

Please sign in to comment.