diff --git a/modules/saml/lib/Auth/Process/PersistentNameID.php b/modules/saml/lib/Auth/Process/PersistentNameID.php
index 5d44689bd5c25ebd0e3cbbb3523c382294015fd5..fd94c59d69d63f0b09012814c8990a48ce14653c 100644
--- a/modules/saml/lib/Auth/Process/PersistentNameID.php
+++ b/modules/saml/lib/Auth/Process/PersistentNameID.php
@@ -60,6 +60,7 @@ class sspmod_saml_Auth_Process_PersistentNameID extends sspmod_saml_BaseNameIDGe
 		}
 		if (count($state['Attributes'][$this->attribute]) > 1) {
 			SimpleSAML_Logger::warning('More than one value in attribute ' . var_export($this->attribute, TRUE) . ' on user - not generating persistent NameID.');
+			return NULL;
 		}
 		$uid = array_values($state['Attributes'][$this->attribute]); /* Just in case the first index is no longer 0. */
 		$uid = $uid[0];