Skip to content

Commit

Permalink
Fix NRE within the ExternalLinkRenderer (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
BentiGorlich authored Feb 1, 2025
1 parent 94c95da commit 505b743
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Markdown/CommonMark/ExternalLinkRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer): H
/** @var Entry|EntryComment|Post|PostComment $entity */
$entity = $this->entityManager->getRepository($apActivity['type'])->find($apActivity['id']);

return new HtmlElement('div', contents: $this->renderInlineEntity($entity));
if (null !== $entity) {
return new HtmlElement('div', contents: $this->renderInlineEntity($entity));
} else {
$this->logger->warning('[ExternalLinkRenderer::render] Could not find an entity for type {t} with id {id} from url {url}', ['t' => $apActivity['type'], 'id' => $apActivity['id'], 'url' => $url]);

return new HtmlElement('div');
}
}
}

Expand Down

0 comments on commit 505b743

Please sign in to comment.