Fix Call to a member function getPreferences() on a non-object when not logged in

This commit is contained in:
Eric Lippmann 2014-01-27 13:22:29 +01:00
parent d03e2fb9d3
commit 71c3fd831f
1 changed files with 5 additions and 4 deletions
library/Icinga/Web/Controller

View File

@ -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();
}
}
}