]> git.mxchange.org Git - friendica-addons.git/commitdiff
[twitter] Fix Undefined property: stdClass::$media_id_string notice
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 14 Oct 2018 11:10:08 +0000 (07:10 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 14 Oct 2018 11:10:08 +0000 (07:10 -0400)
twitter/twitter.php

index 5a808d39f60d305470c4e60d64df99b4be6efb6e..9f07fa52c2d69aa206405f414c3cc480c402a0b6 100644 (file)
@@ -591,7 +591,11 @@ function twitter_post_hook(App $a, array &$b)
 
                                unlink($tempfile);
 
-                               $post['media_ids'] = $media->media_id_string;
+                               if (isset($media->media_id_string)) {
+                                       $post['media_ids'] = $media->media_id_string;
+                               } else {
+                                       throw new Exception('Failed upload of ' . $image);
+                               }
                        } catch (Exception $e) {
                                logger('Exception when trying to send to Twitter: ' . $e->getMessage());