Skip to content

Commit

Permalink
EWPP-0000: Preventing crashes if index item is missing the original.
Browse files Browse the repository at this point in the history
  • Loading branch information
upchuk committed Aug 9, 2023
1 parent dbc3b15 commit 5f59c61
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ public function getLinks(int $limit = NULL, int $offset = 0): LinkCollectionInte
}

foreach ($results->getResultItems() as $item) {
$entity = $item->getOriginalObject()->getEntity();
try {
// Do not crash the application in case the index still has an item in
// it pointing to an entity that got deleted.
$entity = $item->getOriginalObject()->getEntity();
}
catch (\Exception $exception) {
continue;
}

/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $this->entityRepository->getTranslationFromContext($entity);
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
Expand Down

0 comments on commit 5f59c61

Please sign in to comment.