1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Fix a bug where Phortune could fatal while building crumbs

Summary: Ref T12451. `$this->getAccount()` may not return an account.

Test Plan:
  - Visit `/phortune/X/`, where `X` is the ID of an account you don't have permission to view.
  - Before patch: fatal.
  - After patch: normal policy exception page.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12451

Differential Revision: https://secure.phabricator.com/D17689
This commit is contained in:
epriestley 2017-04-14 09:16:22 -07:00
parent 1e43d57c81
commit 7274e4857c

View file

@ -32,13 +32,14 @@ abstract class PhortuneAccountProfileController
} }
protected function buildApplicationCrumbs() { protected function buildApplicationCrumbs() {
$account = $this->getAccount();
$id = $account->getID();
$account_uri = $this->getApplicationURI("/{$id}/");
$crumbs = parent::buildApplicationCrumbs(); $crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb($account->getName(), $account_uri);
$crumbs->setBorder(true); $crumbs->setBorder(true);
$account = $this->getAccount();
if ($account) {
$crumbs->addTextCrumb($account->getName(), $account->getURI());
}
return $crumbs; return $crumbs;
} }