Skip to content

Commit

Permalink
Update ItemUtils.java
Browse files Browse the repository at this point in the history
Prevent npe if bitstream is null
  • Loading branch information
amgciadev authored Jul 16, 2023
1 parent b2bffe5 commit acf376d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ private static Element createBundlesElement(Context context, Item item) throws S
bundle.getElement().add(bitstreams);
List<Bitstream> bits = b.getBitstreams();
for (Bitstream bit : bits) {
// Check if bitstream is null and log the error
if (bit == null) {
log.error("Null bitstream found, check item uuid: " + item.getID());
break;
}
Element bitstream = create("bitstream");
bitstreams.getElement().add(bitstream);
String url = "";
Expand Down

0 comments on commit acf376d

Please sign in to comment.