From e6e4baa872491b423748a1e7835c3229d5bd9481 Mon Sep 17 00:00:00 2001
From: Hypolite Petovan <hypolite@mrpetovan.com>
Date: Fri, 6 Mar 2020 20:49:43 -0500
Subject: [PATCH] Return early if link is missing from share block in
 Model\Item

- Address https://github.com/friendica/friendica/issues/7998#issuecomment-594992869
---
 src/Model/Item.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/Model/Item.php b/src/Model/Item.php
index d47d19cb7d..fe62e888d0 100644
--- a/src/Model/Item.php
+++ b/src/Model/Item.php
@@ -3873,6 +3873,10 @@ class Item
 		// first try to fetch the item via the GUID. This will work for all reshares that had been created on this system
 		$shared_item = self::selectFirst(['title', 'body', 'attach'], ['guid' => $shared['guid'], 'uid' => [0, $uid]]);
 		if (!DBA::isResult($shared_item)) {
+			if (empty($shared['link'])) {
+				return $item;
+			}
+
 			// Otherwhise try to find (and possibly fetch) the item via the link. This should work for Diaspora and ActivityPub posts
 			$id = self::fetchByLink($shared['link'], $uid);
 			if (empty($id)) {