Skip to content

Commit 814751e

Browse files
committed
prevent null pointer Exception
1 parent ac8cd89 commit 814751e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/edu/harvard/iq/dataverse/api/Datasets.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,8 @@ public Response createAssignment(@Context ContainerRequestContext crc, RoleAssig
20872087
return ok(
20882088
json(execCommand(new AssignRoleCommand(assignee, theRole, dataset, createDataverseRequest(getRequestUser(crc)), privateUrlToken))));
20892089
} catch (WrappedResponse ex) {
2090-
if (ExceptionUtils.getRootCause(ex).getMessage().contains("duplicate key")) {
2090+
var message = ExceptionUtils.getRootCause(ex).getMessage();
2091+
if (message != null && message.contains("duplicate key")) {
20912092
// concurrent update
20922093
return error(Status.CONFLICT, BundleUtil.getStringFromBundle("datasets.api.grant.role.assignee.has.role.error"));
20932094
}

0 commit comments

Comments
 (0)