diff --git a/src/applications/badges/controller/PhabricatorBadgesAwardController.php b/src/applications/badges/controller/PhabricatorBadgesAwardController.php --- a/src/applications/badges/controller/PhabricatorBadgesAwardController.php +++ b/src/applications/badges/controller/PhabricatorBadgesAwardController.php @@ -19,17 +19,17 @@ if ($request->isFormPost()) { $badge_phids = $request->getArr('badgePHIDs'); - $badges = id(new PhabricatorBadgesQuery()) - ->setViewer($viewer) - ->withPHIDs($badge_phids) - ->requireCapabilities( - array( - PhabricatorPolicyCapability::CAN_EDIT, - PhabricatorPolicyCapability::CAN_VIEW, - )) - ->execute(); - if (!$badges) { - return new Aphront404Response(); + $badges = array(); + if (!empty($badge_phids)) { + $badges = id(new PhabricatorBadgesQuery()) + ->setViewer($viewer) + ->withPHIDs($badge_phids) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_EDIT, + PhabricatorPolicyCapability::CAN_VIEW, + )) + ->execute(); } $award_phids = array($user->getPHID());