Skip to content

Commit

Permalink
Fix a potential PHP 8 warning if the target page is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
qzminski committed Dec 8, 2022
1 parent 30a467e commit 8f56670
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/EventListener/Navigation/AbstractNavigationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,18 @@ public function onChangelanguageNavigation(ChangelanguageNavigationEvent $event)
return;
}

$targetPage = $navigationItem->getTargetPage();

if (null === $targetPage) {
return;
}

$translated = $this->findPublishedBy(
[
"($t.id=? OR $t.languageMain=?)",
sprintf('%s.pid=(SELECT id FROM %s WHERE (id=? OR master=?) AND jumpTo=?)', $t, $parent::getTable()),
],
[$mainId, $mainId, $masterId, $masterId, $navigationItem->getTargetPage()->id]
[$mainId, $mainId, $masterId, $masterId, $targetPage->id]
);

if (null === $translated) {
Expand Down

0 comments on commit 8f56670

Please sign in to comment.