Skip to content

Commit

Permalink
Merge pull request #1924 from saparaj/release-13
Browse files Browse the repository at this point in the history
CherryPick:13 Guard against NPE in manageRelationFromResourceToSubResources from Discovery class
  • Loading branch information
brendandburns authored Oct 14, 2021
2 parents e9e2032 + abadd9d commit 6c0a01f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion util/src/main/java/io/kubernetes/client/Discovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ private Map<String, Set<String>> manageRelationFromResourceToSubResources(
getSubResourceNameIfPossible(r.getName())
.ifPresent(
subResourceName -> {
subResources.get(getMajorResourceName(r.getName())).add(subResourceName);
subResources
.computeIfAbsent(
getMajorResourceName(r.getName()),
majorResourceName -> new HashSet<>())
.add(subResourceName);
});
});
return subResources;
Expand Down

0 comments on commit 6c0a01f

Please sign in to comment.