Skip to content

Commit

Permalink
Merge pull request #128 from nchiasson-dgi/fix/edtfyear-null-paragraph
Browse files Browse the repository at this point in the history
Adding a null check for the $paragraph_entity
  • Loading branch information
jordandukart authored Jul 3, 2024
2 parents 2d42fcd + 641a008 commit 96dfd66
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 96dfd66

Please sign in to comment.