diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3bc86df0225..aa065dcbceb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -835,6 +835,12 @@ class User extends CommonObject dol_syslog(get_class($this)."::addrights $rid, $allmodule, $allperms, $entity, $notrigger for user id=".$this->id); + if (empty($this->id)) { + $error++; + $this->error = 'Try to call addrights on an object user with an empty id'; + return -1; + } + $error = 0; $whereforadd = '';