From 86d6abe9db2632708043db7caa30bbdcd19f8f64 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 May 2020 09:43:01 -0700 Subject: [PATCH] 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 --- .../harbormaster/view/HarbormasterBuildView.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/applications/harbormaster/view/HarbormasterBuildView.php b/src/applications/harbormaster/view/HarbormasterBuildView.php index 54f5abe093..f54b1d3ba6 100644 --- a/src/applications/harbormaster/view/HarbormasterBuildView.php +++ b/src/applications/harbormaster/view/HarbormasterBuildView.php @@ -34,7 +34,7 @@ final class HarbormasterBuildView $list = new PHUIObjectItemListView(); foreach ($builds as $build) { $id = $build->getID(); - $initiator = $handles[$build->getInitiatorPHID()]; + $buildable_object = $handles[$build->getBuildable()->getBuildablePHID()]; $item = id(new PHUIObjectItemView()) @@ -46,7 +46,9 @@ final class HarbormasterBuildView ->setEpoch($build->getDateCreated()) ->addAttribute($buildable_object->getName()); - if ($initiator) { + $initiator_phid = $build->getInitiatorPHID(); + if ($initiator_phid) { + $initiator = $handles[$initiator_phid]; $item->addByline($initiator->renderLink()); }