diff --git a/src/Factory/Api/Twitter/User.php b/src/Factory/Api/Twitter/User.php
index e545bd78cb..c502e3830a 100644
--- a/src/Factory/Api/Twitter/User.php
+++ b/src/Factory/Api/Twitter/User.php
@@ -48,6 +48,10 @@ class User extends BaseFactory
 			$userContact = [];
 		}
 
+		if (empty($publicContact)) {
+			return null;
+		}
+
 		$apcontact = APContact::getByURL($publicContact['url'], false);
 
 		return new \Friendica\Object\Api\Twitter\User($publicContact, $apcontact, $userContact, $skip_status, $include_user_entities);
diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php
index a64ffbf914..8e5743facb 100644
--- a/tests/legacy/ApiTest.php
+++ b/tests/legacy/ApiTest.php
@@ -2234,6 +2234,7 @@ class ApiTest extends FixtureTest
 				'author-network' => Protocol::DFRN,
 				'author-link'    => 'http://localhost/profile/othercontact',
 				'plink'          => '',
+				'uid'            => $this->selfUser['id'],
 			]
 		];
 		foreach ($items as $item) {
@@ -2257,6 +2258,7 @@ class ApiTest extends FixtureTest
 				'author-network' => Protocol::DFRN,
 				'author-link'    => 'http://localhost/profile/othercontact',
 				'plink'          => '',
+				'uid'            => $this->selfUser['id'],
 			]
 		];