Skip to content

Commit

Permalink
[FIXED JENKINS-18193] NPE thrown when Jenkins failed to initialize.
Browse files Browse the repository at this point in the history
Not really solving anything here—there is no plausible implementation that could run under these circumstances—
but at least reporting the problem more clearly.
  • Loading branch information
jglick committed Jun 4, 2013
1 parent 638537d commit 91a62d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/jenkins/security/ConfidentialStore.java
Expand Up @@ -63,7 +63,11 @@ public abstract class ConfidentialStore {
public static @Nonnull ConfidentialStore get() {
if (TEST!=null) return TEST.get();

Lookup lookup = Jenkins.getInstance().lookup;
Jenkins j = Jenkins.getInstance();
if (j == null) {
throw new IllegalStateException("cannot initialize confidential key store until Jenkins has started");
}
Lookup lookup = j.lookup;
ConfidentialStore cs = lookup.get(ConfidentialStore.class);
if (cs==null) {
try {
Expand Down

0 comments on commit 91a62d6

Please sign in to comment.