]> git.mxchange.org Git - friendica.git/commitdiff
Handle some fatal errors
authorMichael <heluecht@pirati.ca>
Sun, 11 Dec 2022 16:48:36 +0000 (16:48 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 11 Dec 2022 16:48:36 +0000 (16:48 +0000)
src/Factory/Api/Mastodon/Status.php
src/Util/Images.php

index 94b42ce79cb5f41d9cd6b077c333e9fef7533b87..18701bb661f36a481cad2cc3b758ad4617eae3d8 100644 (file)
@@ -199,8 +199,11 @@ class Status extends BaseFactory
                        }
                }
 
-               $item['body']     = $this->contentItem->addSharedPost($item);
-               $item['raw-body'] = $this->contentItem->addSharedPost($item, $item['raw-body']);
+               $item['body'] = $this->contentItem->addSharedPost($item);
+
+               if (!is_null($item['raw-body'])) {
+                       $item['raw-body'] = $this->contentItem->addSharedPost($item, $item['raw-body']);
+               }
 
                if ($is_reshare) {
                        $reshare = $this->createFromUriId($uriId, $uid, false)->toArray();
index 533feec844f62ddf75b83a006cae49daf7fe31e1..a6a9f4f7db78f66255bf86f9dbf457521742afa6 100644 (file)
@@ -247,8 +247,11 @@ class Images
                if ($data) {
                        $image = new Image($img_str);
 
-                       $data['blurhash'] = $image->getBlurHash();
-                       $data['size']     = $filesize;
+                       if ($image->isValid()) {
+                               $data['blurhash'] = $image->getBlurHash();
+                       }
+
+                       $data['size'] = $filesize;
                }
 
                return is_array($data) ? $data : [];