From fea67c985884e7e203e45eb32fea0597c584db8f Mon Sep 17 00:00:00 2001
From: 20after4 <20after4@deviantart.com>
Date: Mon, 18 Jun 2012 06:04:20 -0700
Subject: [PATCH] Partial fix for owners bug where a package's repository
doesn't exist.
Summary: Avoid requesting a non-existent repository...
Test Plan: Delete a repo that has an associated owners package. Then verify that the owners list page no longer throws an exception.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T1372
Differential Revision: https://secure.phabricator.com/D2776
---
.../PhabricatorOwnersListController.php | 36 ++++++++++---------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php
index fc364c10ed..a6fb2287a2 100644
--- a/src/applications/owners/controller/PhabricatorOwnersListController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersListController.php
@@ -262,23 +262,27 @@ final class PhabricatorOwnersListController
$pkg_paths = idx($paths, $package->getID(), array());
foreach ($pkg_paths as $key => $path) {
$repo = $repositories[$path->getRepositoryPHID()];
- $drequest = DiffusionRequest::newFromDictionary(
- array(
- 'repository' => $repo,
- 'path' => $path->getPath(),
- ));
- $href = $drequest->generateURI(
- array(
- 'action' => 'browse',
- ));
- $pkg_paths[$key] =
- ''.phutil_escape_html($repo->getName()).' '.
- phutil_render_tag(
- 'a',
+ if ($repo) {
+ $drequest = DiffusionRequest::newFromDictionary(
array(
- 'href' => (string) $href,
- ),
- phutil_escape_html($path->getPath()));
+ 'repository' => $repo,
+ 'path' => $path->getPath(),
+ ));
+ $href = $drequest->generateURI(
+ array(
+ 'action' => 'browse',
+ ));
+ $pkg_paths[$key] =
+ ''.phutil_escape_html($repo->getName()).' '.
+ phutil_render_tag(
+ 'a',
+ array(
+ 'href' => (string) $href,
+ ),
+ phutil_escape_html($path->getPath()));
+ } else {
+ $pkg_paths[$key] = phutil_escape_html($path->getPath());
+ }
}
$pkg_paths = implode('
', $pkg_paths);