Fix JENKINS-14338

Added check to see if AbstractProject is null before trying to use it.