diff --git a/lib/base.php b/lib/base.php
index 57a3ae8669b11bd22dcd48e0184d66910b0ac42e..ade4d889631dbbdca1eec35e000774ae0bceab32 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -82,7 +82,7 @@ class OC{
 		ini_set('arg_separator.output','&');
 
 		//set http auth headers for apache+php-cgi work around
-		if (preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches))
+		if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches))
 		{
 			list($name, $password) = explode(':', base64_decode($matches[1]));
 			$_SERVER['PHP_AUTH_USER'] = strip_tags($name);