From eecd15ee687ecffe033ff109e2684b0e1bac283d Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 25 Apr 2016 15:26:08 +0200 Subject: [PATCH] NavigationItem: fall back to the default renderer if an error occurrs fixes #10486 --- library/Icinga/Web/Navigation/NavigationItem.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Navigation/NavigationItem.php b/library/Icinga/Web/Navigation/NavigationItem.php index c699a6d00..0f31a4209 100644 --- a/library/Icinga/Web/Navigation/NavigationItem.php +++ b/library/Icinga/Web/Navigation/NavigationItem.php @@ -7,6 +7,7 @@ use Exception; use InvalidArgumentException; use IteratorAggregate; use Icinga\Application\Icinga; +use Icinga\Application\Logger; use Icinga\Exception\IcingaException; use Icinga\Exception\ProgrammingError; use Icinga\Web\Navigation\Renderer\NavigationItemRenderer; @@ -815,7 +816,20 @@ class NavigationItem implements IteratorAggregate */ public function render() { - return $this->getRenderer()->setItem($this)->render(); + try { + return $this->getRenderer()->setItem($this)->render(); + } catch (Exception $e) { + Logger::error( + 'Could not invoke custom navigation item renderer. %s in %s:%d with message: %s', + get_class($e), + $e->getFile(), + $e->getLine(), + $e->getMessage() + ); + + $renderer = new NavigationItemRenderer(); + return $renderer->render($this); + } } /**