Skip to content

Commit 120f8ec

Browse files
authored
Merge pull request jenkinsci#76 from vivek/npe-fix
Fix for NPE in GithubOAuthUserDetails.getAuthorities()
2 parents 599a932 + d70cc97 commit 120f8ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/jenkinsci/plugins/GithubOAuthUserDetails.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public GrantedAuthority[] getAuthorities() {
4242
if (!hasGrantedAuthorities) {
4343
try {
4444
GHUser user = authenticationToken.loadUser(getUsername());
45-
setAuthorities(authenticationToken.getGrantedAuthorities(user));
45+
if(user != null) {
46+
setAuthorities(authenticationToken.getGrantedAuthorities(user));
47+
}
4648
} catch (IOException e) {
4749
throw new RuntimeException(e);
4850
}

0 commit comments

Comments
 (0)