diff --git a/application/modules/auth/controllers/IndexController.php b/application/modules/auth/controllers/IndexController.php
index 4291c41ab0a45b72143d22a9ae788afc060e2d86..d383236e6646215be0cb0b3fc22c12a68b486952 100644
--- a/application/modules/auth/controllers/IndexController.php
+++ b/application/modules/auth/controllers/IndexController.php
@@ -20,8 +20,12 @@ class Auth_IndexController extends App_Controller_Action {
 	{
 		$session = new Zend_Session_Namespace(__CLASS__);
 		$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
+		try {
 		$referer = Zend_Uri_Http::factory($_SERVER['HTTP_REFERER']);
-		if ($referer->getHost() == $_SERVER['HTTP_HOST'] &&
+		} catch (Exception $e) {
+		}
+		if ($referer && 
+		    $referer->getHost() == $_SERVER['HTTP_HOST'] &&
 		    (!$referer->getPort() || $referer->getPort() == $_SERVER['SERVER_PORT']) &&
 		    substr($referer->getPath(), 0, strlen($baseUrl)) == $baseUrl) {
 		    $session->referer = substr($referer->getPath(), strlen($baseUrl));