Skip to content

Commit

Permalink
Fix possible NPE from resource loading
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlloyd committed May 3, 2024
1 parent 24d8c7a commit 97c797a
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 97c797a

Please sign in to comment.