diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 3d247663b3..b2fcac1064 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -6,6 +6,7 @@ * @author Joas Schilling * @author Morris Jobke * @author Thomas Müller + * @author Jörn Friedrich Dreyer * * @license AGPL-3.0 * @@ -32,6 +33,7 @@ use OCP\IAvatarManager; use OCP\IConfig; use OCP\Image; use OCP\IUserManager; +use OCP\Util; /** * User @@ -111,6 +113,14 @@ class User { IConfig $config, FilesystemHelper $fs, Image $image, LogWrapper $log, IAvatarManager $avatarManager, IUserManager $userManager) { + if ($username === null) { + $log->log("uid for '$dn' must not be null!", Util::ERROR); + throw new \InvalidArgumentException('uid must not be null!'); + } else if ($username === '') { + $log->log("uid for '$dn' must not be an empty string", Util::ERROR); + throw new \InvalidArgumentException('uid must not be an empty string!'); + } + $this->access = $access; $this->connection = $access->getConnection(); $this->config = $config;