]> git.mxchange.org Git - friendica.git/commitdiff
Check for parent existence in Protocol\DFRN
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 20 Aug 2020 13:34:37 +0000 (09:34 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 20 Aug 2020 13:34:37 +0000 (09:34 -0400)
- Address https://github.com/friendica/friendica/issues/8877#issuecomment-660263687

src/Protocol/DFRN.php

index 064f1f3aca6027972c20cdc09cc8fb43fe824c46..b09c1bea0f8672479743c4d220637071a83be23c 100644 (file)
@@ -963,10 +963,12 @@ class DFRN
                if ($item['gravity'] != GRAVITY_PARENT) {
                        $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
                        $parent = Item::selectFirst(['guid', 'plink'], ['uri' => $parent_item, 'uid' => $item['uid']]);
-                       $attributes = ["ref" => $parent_item, "type" => "text/html",
-                                               "href" => $parent['plink'],
-                                               "dfrn:diaspora_guid" => $parent['guid']];
-                       XML::addElement($doc, $entry, "thr:in-reply-to", "", $attributes);
+                       if (DBA::isResult($parent)) {
+                               $attributes = ["ref" => $parent_item, "type" => "text/html",
+                                       "href" => $parent['plink'],
+                                       "dfrn:diaspora_guid" => $parent['guid']];
+                               XML::addElement($doc, $entry, "thr:in-reply-to", "", $attributes);
+                       }
                }
 
                // Add conversation data. This is used for OStatus