Skip to content

Commit da0ed77

Browse files
authored
Guard against NPE in BagGenerator (#12246)
* Guard against NPE * Release note
1 parent 2cffaa9 commit da0ed77

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a problem in the BagPack generator, which caused the export to fail for datasets with multiple Contact Points, of which some had no name while others did.

src/main/java/edu/harvard/iq/dataverse/util/bagit/BagGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ private String generateInfoFile() {
938938
info.append(CRLF);
939939

940940
} else {
941-
if (contactNameTerm != null) {
941+
if (contactNameTerm != null && ((JsonObject) person).has(contactNameTerm.getLabel())) {
942942
info.append(multilineWrap(CONTACT_NAME + ((JsonObject) person).get(contactNameTerm.getLabel()).getAsString()));
943943
info.append(CRLF);
944944
}

0 commit comments

Comments
 (0)