fix bug on detect active theme

This commit is contained in:
Nicolas Lœuillet
2015-10-06 20:51:40 +02:00
parent 3123b3c0c8
commit ce782c84b8
2 changed files with 10 additions and 4 deletions

View File

@ -42,7 +42,13 @@ class DetectActiveTheme implements DeviceDetectionInterface
*/
public function getType()
{
$user = $this->securityContext->getToken()->getUser();
$token = $this->securityContext->getToken();
if (is_null($token)) {
return $this->defaultTheme;
}
$user = $token->getUser();
if (!$user instanceof User) {
return $this->defaultTheme;