From 945a69f0cd798a0d7c0cad9ca8d4b5bf03b1e7e4 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 8 Apr 2022 10:27:35 +0200 Subject: [PATCH] Menu: Swallow silently any DB issue in the main menu --- library/Icinga/Web/Menu.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/library/Icinga/Web/Menu.php b/library/Icinga/Web/Menu.php index e5ee4b075..44edf316d 100644 --- a/library/Icinga/Web/Menu.php +++ b/library/Icinga/Web/Menu.php @@ -165,15 +165,21 @@ class Menu extends Navigation $homes = Home::on(Dashboard::getConn()); $homes->filter(Filter::equal('username', $user->getUsername())); - foreach ($homes as $home) { - $dashboardHome = new DashboardHomeItem($home->name, [ - 'uuid' => $home->id, - 'label' => t($home->label), - 'priority' => $home->priority, - 'type' => $home->type, - ]); + try { + foreach ($homes as $home) { + $dashboardHome = new DashboardHomeItem($home->name, [ + 'uuid' => $home->id, + 'label' => t($home->label), + 'priority' => $home->priority, + 'type' => $home->type, + ]); - $dashboardItem->addChild($dashboardHome); + $dashboardItem->addChild($dashboardHome); + } + } catch (\Exception $_) { + // Nothing to do + // Any database issue will be noticed soon enough, so prevent the Menu + // from being ruined in any case. } }