diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index 1304e906cd..6b414a9fe7 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -17,9 +17,15 @@ final class PhamePostViewController extends PhamePostController { $blog = $post->getBlog(); $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb( - $blog->getName(), - $this->getApplicationURI('blog/view/'.$blog->getID().'/')); + if ($blog) { + $crumbs->addTextCrumb( + $blog->getName(), + $this->getApplicationURI('blog/view/'.$blog->getID().'/')); + } else { + $crumbs->addTextCrumb( + pht('[No Blog]'), + null); + } $crumbs->addTextCrumb( $post->getTitle(), $this->getApplicationURI('post/view/'.$post->getID().'/')); diff --git a/src/applications/phame/query/PhamePostSearchEngine.php b/src/applications/phame/query/PhamePostSearchEngine.php index 84fec54df0..68c94552bb 100644 --- a/src/applications/phame/query/PhamePostSearchEngine.php +++ b/src/applications/phame/query/PhamePostSearchEngine.php @@ -81,15 +81,20 @@ final class PhamePostSearchEngine foreach ($posts as $post) { $id = $post->getID(); - $blog = $viewer->renderHandle($post->getBlogPHID())->render(); + $blog = $post->getBlog(); + if ($blog) { + $blog_name = $viewer->renderHandle($post->getBlogPHID())->render(); + $blog_name = pht('Blog: %s', $blog_name); + } else { + $blog_name = pht('[No Blog]'); + } $item = id(new PHUIObjectItemView()) ->setUser($viewer) ->setObject($post) ->setHeader($post->getTitle()) ->setStatusIcon('fa-star') ->setHref($this->getApplicationURI("/post/view/{$id}/")) - ->addAttribute( - pht('Blog: %s', $blog)); + ->addAttribute($blog_name); if ($post->isDraft()) { $item->setStatusIcon('fa-star-o grey'); $item->setDisabled(true); diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index da464a4a46..eb04679e1f 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -169,6 +169,8 @@ final class PhamePost extends PhameDAO return $this->getBlog()->getViewPolicy(); } else if ($this->getBlog()) { return $this->getBlog()->getEditPolicy(); + } else { + return PhabricatorPolicies::POLICY_NOONE; } break; case PhabricatorPolicyCapability::CAN_EDIT: