CCM NG/ccm-cms: Avoid NPE in ItemWorkflowRequestLocalHelper when no workflow is assigned to a ContentItem.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4790 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
b35bd0e20f
commit
f2683c4a9b
|
|
@ -53,11 +53,16 @@ class ItemWorkflowRequestLocalHelper {
|
||||||
.format("No ContentItem with ID %d in the database.",
|
.format("No ContentItem with ID %d in the database.",
|
||||||
item.getObjectId())));
|
item.getObjectId())));
|
||||||
|
|
||||||
final Workflow workflow = workflowRepo
|
final Workflow workflow;
|
||||||
|
if (contentItem.getWorkflow() == null) {
|
||||||
|
workflow = null;
|
||||||
|
} else {
|
||||||
|
workflow = workflowRepo
|
||||||
.findById(contentItem.getWorkflow().getWorkflowId())
|
.findById(contentItem.getWorkflow().getWorkflowId())
|
||||||
.orElseThrow(() -> new IllegalArgumentException(String
|
.orElseThrow(() -> new IllegalArgumentException(String
|
||||||
.format("No Workflow with ID %d in the database.",
|
.format("No Workflow with ID %d in the database.",
|
||||||
contentItem.getWorkflow().getWorkflowId())));
|
contentItem.getWorkflow().getWorkflowId())));
|
||||||
|
}
|
||||||
|
|
||||||
return workflow;
|
return workflow;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue