1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Prevent an error when the Drydock lease artifact does not exist

Summary: If a host artifact exists in a Harbormaster build, where the Drydock lease no longer exists, then an error will be raised because of the attempt to access an undefined index.  This changes the code to use `idx()` so that it correctly returns null instead.

Test Plan: Tested in production.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: joshuaspence, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13074
This commit is contained in:
J Rhodes 2015-06-01 00:39:57 +10:00
parent 8ea13f3ce9
commit e7e585820b

View file

@ -77,7 +77,7 @@ final class HarbormasterBuildArtifact extends HarbormasterDAO
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($data['drydock-lease'])) ->withIDs(array($data['drydock-lease']))
->execute(); ->execute();
$lease = $leases[$data['drydock-lease']]; $lease = idx($leases, $data['drydock-lease']);
return id(new PHUIObjectItemView()) return id(new PHUIObjectItemView())
->setObjectName(pht('Drydock Lease')) ->setObjectName(pht('Drydock Lease'))