fix: [internal] User model can be null

pull/8270/head
Jakub Onderka 2022-04-10 15:08:52 +02:00
parent c419fb69ea
commit ff55803a17
1 changed files with 1 additions and 1 deletions

View File

@ -363,7 +363,7 @@ class AppController extends Controller
{
// Notifications and homepage is not necessary for AJAX or REST requests
$user = $this->Auth->user();
if ($user && !$this->_isRest() && !$this->request->is('ajax')) {
if ($user && !$this->_isRest() && isset($this->User) && !$this->request->is('ajax')) {
$hasNotifications = $this->User->hasNotifications($user);
$this->set('hasNotifications', $hasNotifications);