File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,10 @@ public function setSession(Session $session): void
50
50
/**
51
51
* Get session based on availability.
52
52
*/
53
- private function getSession (): Session
53
+ private function getSession (): ? Session
54
54
{
55
55
$ session = $ this ->session ;
56
- if (null === $ session ) {
56
+ if (null === $ session && $ this -> requestStack -> getCurrentRequest ()-> hasSession () ) {
57
57
$ session = $ this ->requestStack ->getSession ();
58
58
}
59
59
@@ -65,23 +65,27 @@ private function getSession(): Session
65
65
*/
66
66
public function activate (): void
67
67
{
68
- $ this ->getSession ()->set (self ::KEY , true );
68
+ if (null !== $ this ->getSession ()) {
69
+ $ this ->getSession ()->set (self ::KEY , true );
70
+ }
69
71
}
70
72
71
73
/**
72
74
* Disable the Edit In Place mode.
73
75
*/
74
76
public function deactivate (): void
75
77
{
76
- $ this ->getSession ()->remove (self ::KEY );
78
+ if (null !== $ this ->getSession ()) {
79
+ $ this ->getSession ()->remove (self ::KEY );
80
+ }
77
81
}
78
82
79
83
/**
80
84
* {@inheritdoc}
81
85
*/
82
86
public function checkRequest (Request $ request = null ): bool
83
87
{
84
- if (!$ this ->getSession ()->has (self ::KEY )) {
88
+ if (null === $ this -> getSession () || !$ this ->getSession ()->has (self ::KEY )) {
85
89
return false ;
86
90
}
87
91
You can’t perform that action at this time.
0 commit comments