diff --git a/src/RealMeService.php b/src/RealMeService.php index 347edca..6d626e9 100644 --- a/src/RealMeService.php +++ b/src/RealMeService.php @@ -468,8 +468,9 @@ public function enforceLogin(HTTPRequest $request, $backUrl = null) // If not, attempt to retrieve authentication data from OneLogin (in case this is called during SAML assertion) try { - if (!$session->get("RealMeErrorBackURL") && Controller::has_curr()) { - $session->set("RealMeErrorBackURL", Controller::curr()->Link("Login")); + $controller = Controller::curr(); + if (!$session->get("RealMeErrorBackURL") && $controller) { + $session->set("RealMeErrorBackURL", $controller->Link("Login")); } $auth = $this->getAuth();