aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php8
-rw-r--r--src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
index 679186c0..054a3752 100644
--- a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
+++ b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
@@ -42,7 +42,13 @@ class DetectActiveTheme implements DeviceDetectionInterface
42 */ 42 */
43 public function getType() 43 public function getType()
44 { 44 {
45 $user = $this->securityContext->getToken()->getUser(); 45 $token = $this->securityContext->getToken();
46
47 if (is_null($token)) {
48 return $this->defaultTheme;
49 }
50
51 $user = $token->getUser();
46 52
47 if (!$user instanceof User) { 53 if (!$user instanceof User) {
48 return $this->defaultTheme; 54 return $this->defaultTheme;
diff --git a/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php b/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php
index 4945e9a9..9af8fad8 100644
--- a/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php
@@ -10,8 +10,8 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
10 { 10 {
11 $extension = new WallabagExtension(); 11 $extension = new WallabagExtension();
12 12
13 $this->assertEquals("lemonde.fr", $extension->removeWww('www.lemonde.fr')); 13 $this->assertEquals('lemonde.fr', $extension->removeWww('www.lemonde.fr'));
14 $this->assertEquals("lemonde.fr", $extension->removeWww('lemonde.fr')); 14 $this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr'));
15 $this->assertEquals("gist.github.com", $extension->removeWww('gist.github.com')); 15 $this->assertEquals('gist.github.com', $extension->removeWww('gist.github.com'));
16 } 16 }
17} 17}