Skip to content
Permalink
Browse files

Fix JENKINS-22610

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 7c9af27c8455e30e9818e85b9351720126778e4a
@@ -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;
@@ -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;

0 comments on commit 7c9af27

Please sign in to comment.
You can’t perform that action at this time.