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

View File

@ -229,10 +229,11 @@ class ActionController extends Zend_Controller_Action
} }
$this->_helper->layout()->setLayout($target); $this->_helper->layout()->setLayout($target);
} }
$userPreferences = $this->getRequest()->getUser()->getPreferences(); if ($user = $this->getRequest()->getUser()) {
if ($userPreferences->get('app.showBenchmark') === true) { if ($user->getPreferences()->get('app.showBenchmark') === true) {
Benchmark::measure('Response ready'); Benchmark::measure('Response ready');
$this->_helper->layout()->benchmark = $this->renderBenchmark(); $this->_helper->layout()->benchmark = $this->renderBenchmark();
}
} }
} }