Skip to content

Commit

Permalink
FOIA-459: Safety code during the XML export.
Browse files Browse the repository at this point in the history
  • Loading branch information
brockfanning committed Feb 27, 2024
1 parent 556a382 commit 7d1a1c0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docroot/modules/custom/foia_export_xml/src/ExportXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,11 @@ protected function exemption3StatuteSection() {
// Add component data for each statute.
foreach ($components as $component_info) {
$agency_component = $component_info->field_agency_component->referencedEntities()[0];
if (empty($agency_component)) {
// This protects against exceptions caused by the existence of empty
// paragraph items.
continue;
}
$item = $this->addElementNs('foia:ReliedUponStatuteOrganizationAssociation', $statuteSection);
$this->addElementNs('foia:ComponentDataReference', $item)
->setAttribute('s:ref', $local_id);
Expand Down

0 comments on commit 7d1a1c0

Please sign in to comment.