From 71c3fd831f9969cde0c44fcc500e718148f1559a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 27 Jan 2014 13:22:29 +0100 Subject: [PATCH] Fix Call to a member function getPreferences() on a non-object when not logged in --- library/Icinga/Web/Controller/ActionController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 25e65cdd8..1e95e36b1 100755 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -229,10 +229,11 @@ class ActionController extends Zend_Controller_Action } $this->_helper->layout()->setLayout($target); } - $userPreferences = $this->getRequest()->getUser()->getPreferences(); - if ($userPreferences->get('app.showBenchmark') === true) { - Benchmark::measure('Response ready'); - $this->_helper->layout()->benchmark = $this->renderBenchmark(); + if ($user = $this->getRequest()->getUser()) { + if ($user->getPreferences()->get('app.showBenchmark') === true) { + Benchmark::measure('Response ready'); + $this->_helper->layout()->benchmark = $this->renderBenchmark(); + } } }