From 4d6953bf795d90d7c636047fc51c6b8c03cd7595 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Thu, 5 Mar 2020 08:13:18 +0000
Subject: [PATCH] Don't show feeds / avoiding errors with empty data

---
 src/Protocol/ActivityPub/Transmitter.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php
index 0b80e9786..ead0c84c0 100644
--- a/src/Protocol/ActivityPub/Transmitter.php
+++ b/src/Protocol/ActivityPub/Transmitter.php
@@ -71,7 +71,7 @@ class Transmitter
 	 */
 	public static function getFollowers($owner, $page = null)
 	{
-		$condition = ['rel' => [Contact::FOLLOWER, Contact::FRIEND], 'network' => Protocol::NATIVE_SUPPORT, 'uid' => $owner['uid'],
+		$condition = ['rel' => [Contact::FOLLOWER, Contact::FRIEND], 'network' => Protocol::FEDERATED, 'uid' => $owner['uid'],
 			'self' => false, 'deleted' => false, 'hidden' => false, 'archive' => false, 'pending' => false];
 		$count = DBA::count('contact', $condition);
 
@@ -120,7 +120,7 @@ class Transmitter
 	 */
 	public static function getFollowing($owner, $page = null)
 	{
-		$condition = ['rel' => [Contact::SHARING, Contact::FRIEND], 'network' => Protocol::NATIVE_SUPPORT, 'uid' => $owner['uid'],
+		$condition = ['rel' => [Contact::SHARING, Contact::FRIEND], 'network' => Protocol::FEDERATED, 'uid' => $owner['uid'],
 			'self' => false, 'deleted' => false, 'hidden' => false, 'archive' => false, 'pending' => false];
 		$count = DBA::count('contact', $condition);
 
@@ -341,6 +341,10 @@ class Transmitter
 			}
 
 			foreach ($activity[$element] as $receiver) {
+				if (empty($receiver)) {
+					continue;
+				}
+
 				if ($receiver == $profile['followers'] && !empty($item_profile['followers'])) {
 					$permissions[$element][] = $item_profile['followers'];
 				} elseif (!in_array($receiver, $exclude)) {
@@ -649,7 +653,7 @@ class Transmitter
 			$blindcopy = in_array($element, ['bto', 'bcc']);
 
 			foreach ($permissions[$element] as $receiver) {
-				if (Network::isUrlBlocked($receiver)) {
+				if (empty($receiver) || Network::isUrlBlocked($receiver)) {
 					continue;
 				}