Skip to content

Commit

Permalink
Fix possible NPE from resource loading
Browse files Browse the repository at this point in the history
Fixes quarkusio#40438.

(cherry picked from commit 97c797a)
  • Loading branch information
dmlloyd authored and gsmet committed May 10, 2024
1 parent db7d390 commit 5b73b8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public void close() {
};

default List<ClassPathResource> getResources(String name) {
return List.of(getResource(name));
ClassPathResource resource = getResource(name);
return resource == null ? List.of() : List.of(resource);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public List<ClassPathResource> getResources(String name) {
final String sanitized = sanitize(name);
final Set<String> resources = this.resources;
if (resources != null && !resources.contains(sanitized)) {
return null;
return List.of();
}
List<ClassPathResource> ret = new ArrayList<>();
apply(tree -> {
Expand All @@ -123,7 +123,7 @@ public List<ClassPathResource> getResources(String name) {

}
});
return null;
return List.of();
});
return ret;
}
Expand Down

0 comments on commit 5b73b8f

Please sign in to comment.