From 8a7429b87964a02ef61db5b883c9b78d9cfda72f Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 13 Jan 2014 14:25:05 -0800 Subject: [PATCH] Fix fatal on project boards with no tasks Summary: Ref T1344. We try to do a bad edge query with no sources right now if there are no tasks in a project. Test Plan: - Hit exception, applied patch, no exception. - Other boards still have tasks. Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T1344 Differential Revision: https://secure.phabricator.com/D7951 --- .../PhabricatorProjectBoardController.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectBoardController.php b/src/applications/project/controller/PhabricatorProjectBoardController.php index fac78072e6..4473ee70aa 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardController.php @@ -54,12 +54,14 @@ final class PhabricatorProjectBoardController ->execute(); $tasks = mpull($tasks, null, 'getPHID'); - $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_COLUMN; - $edge_query = id(new PhabricatorEdgeQuery()) - ->withSourcePHIDs(mpull($tasks, 'getPHID')) - ->withEdgeTypes(array($edge_type)) - ->withDestinationPHIDs(mpull($columns, 'getPHID')); - $edge_query->execute(); + if ($tasks) { + $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_COLUMN; + $edge_query = id(new PhabricatorEdgeQuery()) + ->withSourcePHIDs(mpull($tasks, 'getPHID')) + ->withEdgeTypes(array($edge_type)) + ->withDestinationPHIDs(mpull($columns, 'getPHID')); + $edge_query->execute(); + } $task_map = array(); $default_phid = $columns[0]->getPHID();