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

Fix an issue where builds with no initiator failed to render in build plans

Summary: See PHI1743. If a build has no initiator PHID, the rendering pathway incorrectly tries to access a handle for it anyway.

Test Plan:
  - Set a build to have no initiator PHID.
  - Viewed the build plan for the build.
  - Before: fatal when trying to access the `null` handle.
  - After: clean build plan rendering.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Differential Revision: https://secure.phabricator.com/D21269
This commit is contained in:
epriestley 2020-05-19 09:43:01 -07:00
parent 770a5c8412
commit 86d6abe9db

View file

@ -34,7 +34,7 @@ final class HarbormasterBuildView
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
foreach ($builds as $build) { foreach ($builds as $build) {
$id = $build->getID(); $id = $build->getID();
$initiator = $handles[$build->getInitiatorPHID()];
$buildable_object = $handles[$build->getBuildable()->getBuildablePHID()]; $buildable_object = $handles[$build->getBuildable()->getBuildablePHID()];
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
@ -46,7 +46,9 @@ final class HarbormasterBuildView
->setEpoch($build->getDateCreated()) ->setEpoch($build->getDateCreated())
->addAttribute($buildable_object->getName()); ->addAttribute($buildable_object->getName());
if ($initiator) { $initiator_phid = $build->getInitiatorPHID();
if ($initiator_phid) {
$initiator = $handles[$initiator_phid];
$item->addByline($initiator->renderLink()); $item->addByline($initiator->renderLink());
} }