From b9fd5262509d1f8ace3f46c9782f8ee0638a3f51 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 4 Oct 2017 07:16:33 -0700 Subject: [PATCH] Fix a fatal on user email settings when `account.editable` is disabled Summary: If `account.editable` is set to false, we try to add a `null` button and fatal: > Argument 1 passed to PHUIHeaderView::addActionLink() must be an instance of PHUIButtonView, null given, called in /srv/phabricator/phabricator/src/applications/settings/panel/PhabricatorSettingsPanel.php on line 290 Instead, don't try to render `null` as a button. Test Plan: - Configured `account.editable` false. - Viewed email address settings. - Before: fatal. - After: page works, no button is provided. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D18677 --- .../panel/PhabricatorEmailAddressesSettingsPanel.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php index 1bdb95f568..cd1bfba540 100644 --- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php @@ -138,9 +138,9 @@ final class PhabricatorEmailAddressesSettingsPanel $editable, )); - $button = null; + $buttons = array(); if ($editable) { - $button = id(new PHUIButtonView()) + $buttons[] = id(new PHUIButtonView()) ->setTag('a') ->setIcon('fa-plus') ->setText(pht('Add New Address')) @@ -149,7 +149,7 @@ final class PhabricatorEmailAddressesSettingsPanel ->setColor(PHUIButtonView::GREY); } - return $this->newBox(pht('Email Addresses'), $table, array($button)); + return $this->newBox(pht('Email Addresses'), $table, $buttons); } private function returnNewAddressResponse(