diff --git a/src/EventListener/Navigation/AbstractNavigationListener.php b/src/EventListener/Navigation/AbstractNavigationListener.php index 76de16c..bbc1268 100644 --- a/src/EventListener/Navigation/AbstractNavigationListener.php +++ b/src/EventListener/Navigation/AbstractNavigationListener.php @@ -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) {