diff --git a/lib/features/drilldown/DrilldownBreadcrumbs.js b/lib/features/drilldown/DrilldownBreadcrumbs.js index 40b2dc030..ba01dfa6e 100644 --- a/lib/features/drilldown/DrilldownBreadcrumbs.js +++ b/lib/features/drilldown/DrilldownBreadcrumbs.js @@ -61,24 +61,31 @@ export default function DrilldownBreadcrumbs(eventBus, elementRegistry, canvas) businessObjectParents = getBusinessObjectParentChain(element); } - var path = businessObjectParents.map(function(parent) { - var title = escapeHTML(parent.name || parent.id); - var link = domify('
  • ' + title + '
  • '); - - var parentPlane = canvas.findRoot(getPlaneIdFromShape(parent)) || canvas.findRoot(parent.id); - - // when the root is a collaboration, the process does not have a corresponding - // element in the elementRegisty. Instead, we search for the corresponding participant + var path = businessObjectParents.flatMap(function(parent) { + var parentPlane = + canvas.findRoot(getPlaneIdFromShape(parent)) || + canvas.findRoot(parent.id); + + // when the root is a collaboration, the process does not have a + // corresponding element in the elementRegisty. Instead, we search + // for the corresponding participant if (!parentPlane && is(parent, 'bpmn:Process')) { var participant = elementRegistry.find(function(element) { var businessObject = getBusinessObject(element); - return businessObject && businessObject.get('processRef') && businessObject.get('processRef') === parent; + return businessObject && businessObject.get('processRef') === parent; }); - parentPlane = canvas.findRoot(participant.id); + parentPlane = participant && canvas.findRoot(participant.id); } + if (!parentPlane) { + return []; + } + + var title = escapeHTML(parent.name || parent.id); + var link = domify('
  • ' + title + '
  • '); + link.addEventListener('click', function() { canvas.setRootElement(parentPlane); }); diff --git a/test/spec/features/drilldown/DrilldownSpec.js b/test/spec/features/drilldown/DrilldownSpec.js index d17620e1f..2d8d96fbe 100644 --- a/test/spec/features/drilldown/DrilldownSpec.js +++ b/test/spec/features/drilldown/DrilldownSpec.js @@ -625,6 +625,18 @@ describe('features/drilldown - integration', function() { expect(warnings).to.be.empty; }); + + it('no for process', async function() { + + const { + error, + warnings + } = await importXML(processMissingBpmnDiagram_XML); + + // then + expect(error).not.to.exist; + expect(warnings).to.be.empty; + }); }); }); diff --git a/test/spec/features/drilldown/process-missing-bpmndiagram.bpmn b/test/spec/features/drilldown/process-missing-bpmndiagram.bpmn new file mode 100644 index 000000000..9959debd8 --- /dev/null +++ b/test/spec/features/drilldown/process-missing-bpmndiagram.bpmn @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +