From fc3b5ddce6a55f12b3a48f3aa54b3b159ae9f0ee Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Tue, 25 Mar 2014 17:35:48 -0700 Subject: [PATCH] Prevent buildable list in Harbormaster from breaking when container or buildables are missing Summary: Ref T1049. I'm fair sure this is just a case of bad data in my local install, but we probably don't want the default page for Harbormaster to break when there's invalid / missing container or buildable handles on any of the builds. Test Plan: Loaded the page, didn't get a crash due to null reference. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: demo, epriestley, Korvin Maniphest Tasks: T1049 Differential Revision: https://secure.phabricator.com/D8608 --- .../controller/HarbormasterBuildableListController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableListController.php b/src/applications/harbormaster/controller/HarbormasterBuildableListController.php index d8e72971f7..130a20470d 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildableListController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildableListController.php @@ -37,8 +37,12 @@ final class HarbormasterBuildableListController $item = id(new PHUIObjectItemView()) ->setHeader(pht('Buildable %d', $buildable->getID())); - $item->addAttribute($buildable->getContainerHandle()->getName()); - $item->addAttribute($buildable->getBuildableHandle()->getFullName()); + if ($buildable->getContainerHandle() !== null) { + $item->addAttribute($buildable->getContainerHandle()->getName()); + } + if ($buildable->getBuildableHandle() !== null) { + $item->addAttribute($buildable->getBuildableHandle()->getFullName()); + } if ($id) { $item->setHref("/B{$id}");