Skip to content

Commit

Permalink
Adding a null check for the $paragraph_entity
Browse files Browse the repository at this point in the history
  • Loading branch information
nchiasson-dgi committed Jun 28, 2024
1 parent 2d42fcd commit 641a008
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Plugin/search_api/processor/EDTFYear.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private function getDateFromParagraphField(EntityInterface $entity, string $bund
$paragraph_entity = $entity->get($paragraph_field_name)
->referencedEntities()[0] ?? NULL;

if ($paragraph_entity->hasField($field_name)
if ($paragraph_entity && $paragraph_entity->hasField($field_name)
&& !$paragraph_entity->get($field_name)->isEmpty()) {
return trim($paragraph_entity->get($field_name)->value);
}
Expand Down

0 comments on commit 641a008

Please sign in to comment.