diff --git a/packages/framework/src/Framework/Features/Navigation/NavigationManager.php b/packages/framework/src/Framework/Features/Navigation/NavigationManager.php index 9313fb65bd0..624953fb886 100644 --- a/packages/framework/src/Framework/Features/Navigation/NavigationManager.php +++ b/packages/framework/src/Framework/Features/Navigation/NavigationManager.php @@ -33,9 +33,8 @@ public function registerMenu(string $name, NavigationMenu $menu): void */ public function getMenu(string $name): NavigationMenu { - if (! Hyde::isBooted()) { - // Todo: This could be an anti-pattern so we may consider throwing an exception instead. - Hyde::boot(); + if (! Hyde::isBooted() && ! isset($this->menus[$name])) { + throw new \Exception('Cannot get navigation menu before the Hyde Kernel is booted.'); } return $this->menus[$name];