From 2f9f862c3016ada908a0b2537bd7305628c2df4a Mon Sep 17 00:00:00 2001 From: Marc Carter Date: Fri, 29 Aug 2014 11:15:31 +0100 Subject: [PATCH] Defend against impl losing TemplateImplementationProperty. Closes #19 --- .../com/joelj/jenkins/eztemplates/utils/TemplateUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java b/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java index 22480f2..f07c78a 100644 --- a/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java +++ b/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java @@ -51,8 +51,8 @@ public static void handleTemplateSaved(AbstractProject templateProject, Template @SuppressWarnings("unchecked") TemplateImplementationProperty impProperty = (TemplateImplementationProperty) project.getProperty(TemplateImplementationProperty.class); - if ( !templateProject.getName().equals(impProperty.getTemplateJobName()) ) { - LOG.warning(String.format("%s doesn't inherit from this template. Cleaning it out of the template.",implementationName)); + if (impProperty == null || !templateProject.getName().equals(impProperty.getTemplateJobName())) { + LOG.warning(String.format("%s doesn't inherit from this template. Cleaning it out of the template.", implementationName)); changedTemplateProject = true; iterator.remove(); continue;