diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index 97dd6bfb35..3a946996cd 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -19,6 +19,7 @@ final class PhabricatorPeopleProfileController $user = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withUsernames(array($this->username)) + ->needProfileImage(true) ->executeOne(); if (!$user) { return new Aphront404Response(); diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php index a4e73d8b16..afb5a67542 100644 --- a/src/applications/people/query/PhabricatorPeopleQuery.php +++ b/src/applications/people/query/PhabricatorPeopleQuery.php @@ -133,11 +133,17 @@ final class PhabricatorPeopleQuery } if ($this->needProfileImage) { - $files = id(new PhabricatorFileQuery()) - ->setViewer($this->getViewer()) - ->withPHIDs(mpull($users, 'getProfileImagePHID')) - ->execute(); - $files = mpull($files, null, 'getPHID'); + $user_profile_file_phids = mpull($users, 'getProfileImagePHID'); + $user_profile_file_phids = array_filter($user_profile_file_phids); + if ($user_profile_file_phids) { + $files = id(new PhabricatorFileQuery()) + ->setViewer($this->getViewer()) + ->withPHIDs($user_profile_file_phids) + ->execute(); + $files = mpull($files, null, 'getPHID'); + } else { + $files = array(); + } foreach ($users as $user) { $image_phid = $user->getProfileImagePHID(); if (isset($files[$image_phid])) {