From c9cf096e86f58339e94f012243272bf1773e0a47 Mon Sep 17 00:00:00 2001 From: Jyrki De Neve Date: Wed, 19 Jun 2024 21:54:03 +0300 Subject: [PATCH] Make route getName optional Since 404 routes return `null` this breaks calling `getName()` --- src/LanguageSwitch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LanguageSwitch.php b/src/LanguageSwitch.php index 41ab680..dc21649 100755 --- a/src/LanguageSwitch.php +++ b/src/LanguageSwitch.php @@ -224,7 +224,7 @@ public function isVisibleInsidePanels(): bool public function isVisibleOutsidePanels(): bool { return (bool) ($this->evaluate($this->visibleOutsidePanels) - && str(request()->route()->getName())->contains($this->outsidePanelRoutes) + && str(request()->route()?->getName())->contains($this->outsidePanelRoutes) && $this->isCurrentPanelIncluded()); }