From 74825fccc4159db96e249b708e6f6ee65bb9d306 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 6 Feb 2016 04:46:46 -0800 Subject: [PATCH] Fix issue with rendering policy controls when an install has zero projects Fixes T10290. Auditors: cahd --- src/view/form/control/AphrontFormPolicyControl.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/view/form/control/AphrontFormPolicyControl.php b/src/view/form/control/AphrontFormPolicyControl.php index 32f5318a18..6448b2b8b2 100644 --- a/src/view/form/control/AphrontFormPolicyControl.php +++ b/src/view/form/control/AphrontFormPolicyControl.php @@ -167,12 +167,17 @@ final class AphrontFormPolicyControl extends AphrontFormControl { $type_project = PhabricatorPolicyType::TYPE_PROJECT; + // Make sure we have a "Projects" group before we adjust it. + if (empty($options[$type_project])) { + $options[$type_project] = array(); + } + + $options[$type_project] = isort($options[$type_project], 'sort'); + $placeholder = id(new PhabricatorPolicy()) ->setName(pht('Other Project...')) ->setIcon('fa-search'); - $options[$type_project] = isort($options[$type_project], 'sort'); - $options[$type_project][$this->getSelectProjectKey()] = array( 'name' => $placeholder->getName(), 'full' => $placeholder->getName(),