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
5050 /**
5151 * Get session based on availability.
5252 */
53- private function getSession (): Session
53+ private function getSession (): ? Session
5454 {
5555 $ session = $ this ->session ;
56- if (null === $ session ) {
56+ if (null === $ session && $ this -> requestStack -> getCurrentRequest ()-> hasSession () ) {
5757 $ session = $ this ->requestStack ->getSession ();
5858 }
5959
@@ -65,23 +65,27 @@ private function getSession(): Session
6565 */
6666 public function activate (): void
6767 {
68- $ this ->getSession ()->set (self ::KEY , true );
68+ if (null !== $ this ->getSession ()) {
69+ $ this ->getSession ()->set (self ::KEY , true );
70+ }
6971 }
7072
7173 /**
7274 * Disable the Edit In Place mode.
7375 */
7476 public function deactivate (): void
7577 {
76- $ this ->getSession ()->remove (self ::KEY );
78+ if (null !== $ this ->getSession ()) {
79+ $ this ->getSession ()->remove (self ::KEY );
80+ }
7781 }
7882
7983 /**
8084 * {@inheritdoc}
8185 */
8286 public function checkRequest (Request $ request = null ): bool
8387 {
84- if (!$ this ->getSession ()->has (self ::KEY )) {
88+ if (null === $ this -> getSession () || !$ this ->getSession ()->has (self ::KEY )) {
8589 return false ;
8690 }
8791
You can’t perform that action at this time.
0 commit comments