diff --git a/lib/Service/SystemService.php b/lib/Service/SystemService.php index 2a3703379..50cc9bdc0 100644 --- a/lib/Service/SystemService.php +++ b/lib/Service/SystemService.php @@ -121,10 +121,13 @@ class SystemService { $list = []; if ($query !== '') { preg_match_all(self::REGEX_PARSE_MAIL, $query, $parsedQuery); - $emailAddress = $parsedQuery[2][0]; - $displayName = $parsedQuery[1][0]; - if ($emailAddress && self::isValidEmail($emailAddress)) { - $list[] = new Email($emailAddress, $displayName, $emailAddress); + + if (!empty($parsedQuery[1]) && !empty($parsedQuery[2])) { + $emailAddress = $parsedQuery[2][0]; + $displayName = $parsedQuery[1][0]; + if ($emailAddress && self::isValidEmail($emailAddress)) { + $list[] = new Email($emailAddress, $displayName, $emailAddress); + } } $list = array_merge($list, UserBase::search($query));